I have come across a strange problem. If I define a constant as follows,
#define FUNC_X TILE_X/2.0 #define FUNC_Y TILE_Y/2.0
The code works fine. If I convert the variables to uniform and then pass the uniform from code like this,
//in glsl shader uniform float FUNC_X; uniform float FUNC_Y; //in client code glUniform1f(glGetUniformLocation(progID, "FUNC_X"), (tileX/2.0f)); glUniform1f(glGetUniformLocation(progID, "FUNC_Y"), (tileY/2.0f));
it does not give the correct output. I even tried changing the #define in the glsl code to this
float FUNC_X=TILE_X/2.0; float FUNC_Y=TILE_Y/2.0;
and it also gives me the wrong result.
Why do i get this behaviour