GLSL weirdness

Started by
0 comments, last by BornToCode 11 years ago

The problem i am having is that i have this chunck of code

#ifdef BONE
mat4 finalmatrix=mat4(0);
float finalweight=0;
for(int i=0;i<4;i++)
{
int index = int(indicies);
finalmatrix+=SPARTAN_MATRIX_BONES[index]*weights;
finalweight+=weights;
}
finalmatrix=finalmatrix/finalweight;

#ifdef POSITION
aposition = (finalmatrix*vec4(position,1.0f)).xyz;
#endif

#ifdef NORMAL
anormal = (finalmatrix*vec4(normal0,0.0f)).xyz;
#endif

#ifdef TANGENT
atangent =(finalmatrix*vec4(tangent0,0.0f)).xyz;
#endif
#endif

which supposed to just do skinning. The problem is that when i pass the entire bone hierachy to SPARTAN_MATRIX_BONE, it is only copying the first index. the function that i am using is glUniform4uiv with a count of numbones. SPARTAN_MATRIX_BONE is defined as an array of 70 mat4. I am so stumped at this point as to why it is not copying the entire thing to the GPU.

Another test i also did is that i try calling the glGet function to make sure that was the case. When i copy the data back to my pointer only the first matrix is filled up every other ones in the array were Identity.

glGetActiveUniform is returning the proper size. So that is what is even more confusing.

At this point i do not know if this is a driver bug i just encountered or what. I am running it on an ATI HD 5800 graphics card.

Advertisement

You know what, i just solved it. It was something stupid. Just in case someone wants to know how i fix it.

The problem was that i was using glGetActiveUniform as the location index. which i should have know better,but to use glGetUniformLocation because the prior one does not handle uniform locations. Dumb me.

This topic is closed to new replies.

Advertisement