s_l_m
|
|
« Reply #4380 on: November 20, 2013, 06:50:13 PM » |
|
Apparently Unity can't generate random numbers from a second thread, because why wouldn't it have some weird bullshit like that?
Edit: I guess switching my code to use the system random instead of the built in Unity random functions works, it's just such a strange limitation
|
|
|
Logged
|
Think happy thoughts.
|
|
|
Geti
|
|
« Reply #4381 on: November 20, 2013, 07:02:01 PM » |
|
Probably don't want race conditions for reproducibility (which the system random doesn't offer afaik) - I usually write a simple xorshift random for each thread or context that I need - helps to prevent breaking seeds for generators when you add a new subsystem (of course, sometimes its unavoidable, but it's better than calling some global)
|
|
|
Logged
|
|
|
|
s_l_m
|
|
« Reply #4382 on: November 20, 2013, 07:06:23 PM » |
|
Probably don't want race conditions for reproducibility (which the system random doesn't offer afaik) - I usually write a simple xorshift random for each thread or context that I need - helps to prevent breaking seeds for generators when you add a new subsystem (of course, sometimes its unavoidable, but it's better than calling some global)
Mhmm, I think I might just write a simple random generator, I am using System.random for now but I would much rather have this thread be as self contained as possible. Also, System.Random conflicts with the unity random stuff if you don't specify so it is probably for the better I avoid it
|
|
|
Logged
|
Think happy thoughts.
|
|
|
Whiteclaws
|
|
« Reply #4383 on: November 23, 2013, 10:46:17 AM » |
|
ARGHHHH... BECAUSE OF ONE SPACE IN MY GLSL SHADER , MY PROGRAM SHOWED A BLACK SCREEN TRIED RE-WRITING 5 TIMES , AND BEEN SCRATCHING MY HEAD FOR 4 WEEKS AND MY CODE WAS GOOD FROM THE BEGINNING !!!!! AND COMPILER DIDN'T SAY NOTHING ABOUT THIS ... //Not Working #version 330 layout(location = 0) in vec3 Position; void main() { gl_Position = vec4(Position, 1); } //Working #version 330 layout(location = 0) in vec3 position; void main() { gl_Position = vec4(position,1); } ////////////////////////////////////////////////////////////////////////////////////////////
Edit : Uh... My head hurts from me hitting the wall with it I guess I learnt my lesson ... the hard way ... C/C++ devs ... I feel your pain...
|
|
« Last Edit: November 23, 2013, 10:52:12 AM by Whiteclaws »
|
Logged
|
|
|
|
Polly
Level 6
|
|
« Reply #4384 on: November 23, 2013, 10:59:25 AM » |
|
Whiteclaws, grab AMD's GPU ShaderAnalyzer to standalone compile shaders ( against a whole slew of cards )* Easiest way to catch these kind of mistakes ( and more ). *Doesn't actually use your GPU, so works fine on NVIDIA / Intel etc. systems too.
|
|
|
Logged
|
|
|
|
ThemsAllTook
|
|
« Reply #4385 on: November 23, 2013, 03:21:05 PM » |
|
BECAUSE OF ONE SPACE IN MY GLSL SHADER , MY PROGRAM SHOWED A BLACK SCREEN
Was it the space, or the capitalization of Position? Latter seems more likely to me, but I don't know all the quirks of the GLSL compiler.
|
|
|
Logged
|
|
|
|
kamac
|
|
« Reply #4386 on: November 24, 2013, 01:42:08 AM » |
|
I'd guess it was the space before the layout keyword, maybe?
|
|
|
Logged
|
|
|
|
InfiniteStateMachine
|
|
« Reply #4387 on: November 25, 2013, 12:25:13 PM » |
|
possibly, does the GLSL even take into account line breaks and carriage returns?
|
|
|
Logged
|
|
|
|
powly
|
|
« Reply #4388 on: November 29, 2013, 11:00:25 AM » |
|
It should ignore all white space that doesn't separate actual expressions apart from line breaks for single line comments (and expressions like 'int a' obviously need that space) so I'm very curious about what's going on. Always remember to consult the compilation error log (and recent drivers) since it actually tells you what's wrong - shader development is a big enough pain in the beginning even if you do. ShaderAnalyzer is a good way to check strictness if you're not on AMD hardware. There are also a couple of debug extensions that seem very nice but I haven't touched them myself quite yet so hard to say if I should recommend them As a side note, neither version is valid GLSL; you're doing an implicit cast. It should be '1.0' in the vec4().
|
|
|
Logged
|
|
|
|
Saishy
|
|
« Reply #4389 on: November 29, 2013, 10:14:17 PM » |
|
I frequently run into problems because Unity think it's cool to discard any decimal result of a integer division.
Because logically, if you are dividing integers it should never have decimal results!
AAAAARRRGGG
|
|
|
Logged
|
|
|
|
ThemsAllTook
|
|
« Reply #4390 on: November 30, 2013, 01:22:26 AM » |
|
I frequently run into problems because Unity think it's cool to discard any decimal result of a integer division.
Most C-family languages work like that. Integer division is a distinct operation from floating point division. Can be a pain if you don't know/don't remember the exact semantics of the language you're using...
|
|
|
Logged
|
|
|
|
rosholger
Level 1
|
|
« Reply #4391 on: December 01, 2013, 04:52:50 PM » |
|
gaaaaaah!! somewhere inside a loop that does't touch the this pointer, it's getting fucking corrupted!! fuck this!!
|
|
|
Logged
|
|
|
|
Geti
|
|
« Reply #4392 on: December 01, 2013, 06:21:01 PM » |
|
Lol potential heap corruption.
You properly sure it's inside the loop?
|
|
|
Logged
|
|
|
|
Endurion
|
|
« Reply #4393 on: December 02, 2013, 02:17:08 AM » |
|
If the this-Pointer looks corrupted you usually need to look one stack trace level higher. You probably called a method on an invalid (deleted or not initialised) object.
|
|
|
Logged
|
|
|
|
rosholger
Level 1
|
|
« Reply #4394 on: December 02, 2013, 08:18:54 AM » |
|
Lol potential heap corruption.
You properly sure it's inside the loop?
yup pretty sure, since the this-pointer works before that loop but not after. If the this-Pointer looks corrupted you usually need to look one stack trace level higher. You probably called a method on an invalid (deleted or not initialised) object.
the strange thing is that the this-pointer looks fine in the stack trace level above, and both are member functions of the same object. i actually found the problem, it was a buffer overflow that caused it
|
|
|
Logged
|
|
|
|
gimymblert
|
|
« Reply #4395 on: December 04, 2013, 10:22:21 AM » |
|
I use to hate programming, but now it's not there I crave it so much more so that getting back into drawing
|
|
|
Logged
|
|
|
|
|
Prads
Level 1
|
|
« Reply #4397 on: December 10, 2013, 10:47:59 AM » |
|
Trying to use GL_LINEAR filter for the texture but it's not working. It has no effect and texture looks same as using GL_NEAREST. I have done this in other programs and it has worked before, just can't figure out why it's not working now. Can anyone check it please? glGenTextures(1, &frameTexture); glBindTexture(GL_TEXTURE_2D, frameTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
Logged
|
|
|
|
makerimages
|
|
« Reply #4398 on: December 10, 2013, 11:14:57 AM » |
|
Cant figure out why the text is not drawing .h #pragma once #include <string> #include "GameObject.h" #include "GameWindow.h" #include <SFML/Graphics.hpp> class MessageBox { public: MessageBox(void); MessageBox(std::string title, std::string content,int x, int y,GameObject* gameO,GameWindow* wI); ~MessageBox(void); void draw(); protected: sf::Font font; sf::Font* boxFont; sf::Text* titleT; sf::Text contentT; int xPos; int yPos; sf::Sprite* spr; GameObject* game; GameWindow* windowIn; };
.cpp #include "MessageBox.h"
using namespace std; MessageBox::MessageBox(string title, string content, int x, int y,GameObject* gameO, GameWindow* wI): xPos(x), yPos(y),game(gameO), windowIn(wI) { if(!font.loadFromFile("data/fonts/LCALLIG.ttf")) { printf("Error loading font! \n"); } boxFont=&font; titleT=&sf::Text(title,*boxFont); spr=game->getSpriteManager()->getSprite(3); spr->setPosition(xPos,yPos); }
MessageBox::~MessageBox(void) { } void MessageBox::draw() { windowIn->getWindow()->draw(*spr); windowIn->getWindow()->draw(*titleT);
} MessageBox::MessageBox(void) { }
spr draws, on its own, titleT doesnt...
|
|
|
Logged
|
Makerimages-Its in the pixel
|
|
|
ThemsAllTook
|
|
« Reply #4399 on: December 10, 2013, 11:16:58 AM » |
|
Trying to use GL_LINEAR filter for the texture but it's not working. It has no effect and texture looks same as using GL_NEAREST. I have done this in other programs and it has worked before, just can't figure out why it's not working now. Can anyone check it please?
Are you scaling up or down? Given that it's a 1024x1024 texture, I'm guessing you might be scaling down by a lot. GL_LINEAR looks pretty bad with too much downscaling (sometimes similar to GL_NEAREST); you'd get better results with mipmaps. As an aside, calling glTexParameter before glTexImage2D is supposedly optimized better on some architectures. Probably wouldn't hurt to swap those around.
|
|
|
Logged
|
|
|
|
|