openGL ES shaders wrong uniforms location -
vertex shader looks this:
uniform mat4 projectionmatrix; uniform mat4 modelmatrix; uniform mat4 viewmatrix; attribute vec4 vposition; attribute vec4 vcolor; varying vec4 vdestinationcolor; void main(void) { gl_position = projectionmatrix * modelmatrix * viewmatrix * vposition; vdestinationcolor = vcolor; }
objective-c code:
_projectionmatrixslot = glgetuniformlocation(_programhandle, "projectionmatrix"); _modelmatrixslot = glgetuniformlocation(_programhandle, "modelmatrix"); _viewmatrixslot = glgetuniformlocation(_programhandle, "viewmatrix"); _positionattribslot = glgetattriblocation(_programhandle, "vposition"); _colorattribslot = glgetattriblocation(_programhandle, "vcolor");
here _projectionmatrixslot _viewmatrixslot _modelmatrixslot equals 4294967295 while _positionattribslot , _colorattribslot fine
the compiler free throw away variables not used in code. therefore, if uniform declared in shader, long not used, reported location can -1 or max int or unsigned int.
you may have attached wrong vertex shader, not 1 post here.
Comments
Post a Comment