Skip to main content
4 of 4
fixed typos, moved raw URL to in text link, left aligned code, added code markdown to code in text
Pikalek
  • 13.4k
  • 5
  • 49
  • 54

I might know what your problem is. I will be honest, I don't know much C#, I'm a C++ guy. But from looking at the repo I see this inside your form1 file

int i = 0; foreach (var bmat in animator.Transformations) { Console.WriteLine("Sending matrix @index " + i + " " + bmat.ToString()); Console.WriteLine(bmat.m00.ToString() + " " + bmat.m10.ToString() + " " + bmat.m20.ToString() + " " + bmat.m30.ToString()); Console.WriteLine(bmat.m01.ToString() + " " + bmat.m11.ToString() + " " + bmat.m21.ToString() + " " + bmat.m31.ToString()); Console.WriteLine(bmat.m02.ToString() + " " + bmat.m12.ToString() + " " + bmat.m22.ToString() + " " + bmat.m32.ToString()); Console.WriteLine(bmat.m03.ToString() + " " + bmat.m13.ToString() + " " + bmat.m23.ToString() + " " + bmat.m33.ToString()); gl.UniformMatrix4fv(gl.GetUniformLocation(program, "finalBonesMatrices[" + i.ToString() + "]"), 1, false, bmat.ToArray()); i++; } 

This specific line has a problem

gl.UniformMatrix4fv(gl.GetUniformLocation(program, "finalBonesMatrices[" + i.ToString() + "]"), 1, false, bmat.ToArray()); 

You are putting 1 in the second parameter, which is the count variable - change this to the size of the array of model matrices. For more info check the glUniform documentation to to check what those parameters mean, from my understanding you needpass it the size of the array.

For more clarification, this is what my code looks like:

glUniformMatrix4fv(currentShader->GetUniformID("gBones[" + std::to_string(i) + ']'), Transforms.size(), GL_FALSE, Transforms[i]); 

Hope this helps. If you find that your model is animating after this but has some weird effects like scaling parts of the body or repositioning them put the animation in Blender and reexport the file, a lot of times that solves the problem.