Jump to content

  • Log In with Google      Sign In   
  • Create Account


GLSL weirdness


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 BornToCode   Members   -  Reputation: 920

Like
0Likes
Like

Posted 27 March 2013 - 02:12 PM

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, 27 March 2013 - 02:14 PM.


Sponsor:

#2 BornToCode   Members   -  Reputation: 920

Like
1Likes
Like

Posted 27 March 2013 - 02:31 PM

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, 27 March 2013 - 02:35 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS