All uniform locations are "-1" on MacOS X
I am experiencing really weird bug.I am porting some OpenGL codebase to
MacOS X 10.7.5 The OpenGL code is suited for GL3.2 version.Original
version (on Windows/Linux") works fine.No errors in GLSL or OpenGL
side.But on Mac, when trying to access the uniforms all the locations are
"-1".It is problematic to put out here the whole code as it is wrapped
into framework(also I am sure 100% it is written correctly as it was
tested to great extent on other platforms),but here is some of GLSL code:
#version 150 core
uniform sampler2D tex;
uniform vec2 dir;
uniform float cont;
noperspective in vec2 uv;
out vec4 colorOut;
void main(){
...
All the uniforms are in use by the shader so it is unlikely that
GLSLcompiler optimizes them out.
UPDATE:
Ok,I have some advance in pinning down the problem.Somehow, it seems that
the character string, I pass to a method which retrieves uniform
location,gets truncated.Here is the test:
Explicit call to :
GLuint loc1 = glGetUniformLocation(shaderEmboss->getHandle(), "dir");
returns the location al right.
But if I pass the location name as param "const GLchar* name" , I can see
in the XCode debugger only the first char of the string.This test, for
example doesn't evaluate to true:
const GLchar *nname = "dir";
if( strcmp(nname,"dir")){
printf("%s","Success");
}
What is that? Does LLVM compiler treat const char pointers differently
from other C++ compilers?
No comments:
Post a Comment