Jump to content
  • Advertisement
Sign in to follow this  
Rhiakath

Skeletal animation

This topic is 3417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there. I'm trying to do some skeletal animation with GLSL, but I'm currently unable to understand a few things. First of all, using GLSL, how do I pass an array of matrices (for the bones)? This is what I'm currently doing. glBindAttribLocation ( Program.GetHandle(), 0, "Bones" ); GLint Location = glGetUniformLocation ( Program.GetHandle(), "Bones" ); assert ( Location != -1 ); glUniformMatrix4fv ( Location, AnimationMatrices.Size(), GL_FALSE, reinterpret_cast <float *> ( AnimationMatrices.GetPointer() ) ); Unfortunately, it always fails on the assert. I can get other uniforms, but never this one. As a matter of fact, I'm unable to get any attrib, only uniforms. How to do it? Here is the vertex shader:
/**
 * file Texturing.vert
 */

uniform mat4 Bones[32];
attribute vec4 BoneIndex;
uniform bool TexturingEnabled;

void main()
	{
	if (TexturingEnabled==true)
		gl_TexCoord[0] = gl_MultiTexCoord0;

	int Index=BoneIndex.x;
	gl_Position = gl_ModelViewProjectionMatrix * ( Bones[int(Index)] * gl_Vertex);
	//gl_FrontColor = gl_Color;
		
	//gl_Position = ftransform();
	}





[Edited by - Rhiakath on May 18, 2009 10:16:40 AM]

Share this post


Link to post
Share on other sites
Advertisement
When you use boneMat in your shader, should that actually be Bones?
When you use boneIndex in your shader, should that actually be BoneIndex?
I'm guessing your shader isn't compiling, which means your program wont link, and all addresses get returned as -1 ?

Share this post


Link to post
Share on other sites
Oh, yeah, sorry. I copied the wrong code.
But yes, it is correct. It is indeed Bone and Index.
It does compile, there's nothing wrong with that part.
I corrected the post above.
It fails later, when trying to put some values inside Bone.
Simply put, I don't know how to do it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!