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

I might know what your problem is. I will be honest, I dontdon't know much C# im, I'm a C++ guy. But from looking at the repo iI 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++;  }   

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

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

You are putting "1"1 in paramater 2the second parameter, which is the count variable, - change this to the size of the array of model matrices. forFor more info check the (https://registry.khronos.org/OpenGL-Refpages/gl4/html/glUniform.xhtmlglUniform documentation) to to check what those parameters mean, from my understanding you gotta passneedpass it the size of the array.

forFor more clarification, this is howwhat my code looks like

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

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 re positioningrepositioning them put the animation in Blender and re exportreexport the file, a lot of times that solves the problem.

I might know what your problem is. I will be honest I dont know much C# im 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++;  }   

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

You are putting "1" in paramater 2 which is the count variable, change this to the size of the array of model matrices. for more info check (https://registry.khronos.org/OpenGL-Refpages/gl4/html/glUniform.xhtml) to to check what those parameters mean, from my understanding you gotta pass it the size of the array.

for more clarification, this is how 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 re positioning them put the animation in Blender and re export the file, a lot of times that solves the problem

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++; } 
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.

added 243 characters in body
Source Link

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 re positioning them put the animation in Blender and re export the file, a lot of times that solves the problem

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 re positioning them put the animation in Blender and re export the file, a lot of times that solves the problem

added 2 characters in body
Source Link

I might know what your problem is. I will be honest I dont know much C# im 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 paramater 2 which is the count variable, change this to the size of the array of model matrices. for more info check (https://registry.khronos.org/OpenGL-Refpages/gl4/html/glUniform.xhtml) to to check what those parameters mean, from my understanding you gotta pass it the size of the array.

for more clarification, this is how my code looks like glUniformMatrix4fv

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

I might know what your problem is. I will be honest I dont know much C# im 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 paramater 2 which is the count variable, change this to the size of the array of model matrices. for more info check (https://registry.khronos.org/OpenGL-Refpages/gl4/html/glUniform.xhtml) to to check what those parameters mean, from my understanding you gotta pass it the size of the array.

for more clarification, this is how my code looks like glUniformMatrix4fv(currentShader->GetUniformID("gBones[" + std::to_string(i) + ']'), Transforms.size(), GL_FALSE, Transforms[i]);

I might know what your problem is. I will be honest I dont know much C# im 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 paramater 2 which is the count variable, change this to the size of the array of model matrices. for more info check (https://registry.khronos.org/OpenGL-Refpages/gl4/html/glUniform.xhtml) to to check what those parameters mean, from my understanding you gotta pass it the size of the array.

for more clarification, this is how my code looks like

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

Source Link
Loading