   buffering skinned meshes
  Hi,I have a following structure defined:struct SkinVertex{vector3f position;vector3f normal;vector2f texCoord;uint jointIndices[4];float jointWeights[4];};I have indices array and matrix palette. Only the palette waries over the time, as animation takes place.I wish to do following things: implement skinning in GLSLand if its possible - buffer the vertices and indices at video ram, as they do not vary over the time.How to do it? I can use OpenGL up to 3.something.Regards,akuda   
  I have just started using OpenGL 3.2 in my game engine. My research has told med that OpenGL 3.2 is supported by all nVidia cards from 8 series and newer, and radeon 2xxx and newer(although I have NO IDEA how AMD's version numbers work)Anyway, you need OpenGL 3.0, then you would use vertex buffer objects (OpenGL 1.5 or something) to buffer your vertex data. At this point the data contained is irrelevant, buffer objects just store your vertex data on video memory. Use glBufferData with first parameter set to GL_ARRAY_BUFFER function to do this.You can use the same thing for indices, ujust replace GL_ARRAY_BUFFER with GL_ELEMENT_ARRAY_BUFFERUse glBindBuffer to make your buffer current before continuingWhen you have a vertex buffer and index buffer, you need to figure out what goes where in your vertex buffer. This is where glAttribArrayPointer and glEnableClientAttrib functions come in. In short, these replace glVertexPointer, glNormalPointer etc. where you get a more generalized approach for your shader code. What you do here, is that you want e.g. in_position in your shader to mean position in your vertex structure.This is done by simply calling glGetAttribLocation(shader_program, "in_position") which returns an integer. This integer will be -1 if there is no such attribute in your shader code, otherwise it will return an integer from 0 and up. This integer must be enabled with glEnableClientAttrib. This is generally the same as the glEnableClientState(), and after you have drawn everything, you should call glDisableClientAttrib with the same parameters.Anyway, when you have your attribute location, you can use this as the first parameter in glAttribPointer. Set the last pointer value as NULL, or the elements offset in your structure. Stride must be the size of your structure.When this is done, you can draw using glDrawElements, glDrawArrays etc. Remember to call glBindBuffer on both the index buffer and vertex buffer, and glBindBuffer([TARGET], 0) when you are finished rendering.   ;  Be sure to use "glVertexAttribIPointerEXT" for your jointIndices buffer instead of "glVertexAttribPointer". I didn't know this and tore my hair out for a day trying to figure out why my index variable was coming out as ~1.7 billion or something instead of 1.glVertexAttribPointer will convert all of your ints to floats, even if you say they are int type and bind it to an integer attribute. It will convert it to a float internally and then interpret the float as an int, which is totally wrong.I can't believe it would do this without error, but its something to watch out for.   