Hello I am trying to get a skeleton animation to work but i am having some trouble setting up my vertex buffer for this. I have a struct for my vertex that reads as such
struct Vertex {
Vec3 VertsPos;
Vec3 Norms;
Vec3 texCoords;
Vec3 boneWeight;
int boneIndex;
};
How would I set up the vertext buffer using opengl 3.1+ so that this struct is interleaved into the vbo with proper padding. also what would the correct gl draw call be?
setting up a VBO for Animation
Just some notes on your vertex structure:
struct Vertex {
Vec3 VertsPos;
Vec3 Norms;
Vec2 texCoords; //most of the time you only need 2 texture coords
Vec4 boneWeight;// try to utilise a whole register ,that are 4 weights
int boneIndex[4];//the number of weights and bone indicies should be equal
};
I'm still not using OGL3.1, but in OGL2.1/GLSL 1.4 I would declare equivalent attributes like this in the vertex shader
attribute vec3 VertsPos;
attribute vec3 Norms;
attribute vec2 texCoords;
attribute vec4 boneWeight;
attribute ivec4 boneIndex;
struct Vertex {
Vec3 VertsPos;
Vec3 Norms;
Vec2 texCoords; //most of the time you only need 2 texture coords
Vec4 boneWeight;// try to utilise a whole register ,that are 4 weights
int boneIndex[4];//the number of weights and bone indicies should be equal
};
I'm still not using OGL3.1, but in OGL2.1/GLSL 1.4 I would declare equivalent attributes like this in the vertex shader
attribute vec3 VertsPos;
attribute vec3 Norms;
attribute vec2 texCoords;
attribute vec4 boneWeight;
attribute ivec4 boneIndex;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement