Sign in to follow this  
BornToCode

GLSL weirdness

Recommended Posts

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[i]);
        finalmatrix+=SPARTAN_MATRIX_BONES[index]*weights[i];
        finalweight+=weights[i];
    }
    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.

Edited by BornToCode

Share this post


Link to post
Share on other sites

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.

Edited by BornToCode

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this