I'm using the latest version of OpenGL and SDL 2.0. Here is my current rendering code to render an object:
for(a=0;a<obj->total_tri;a++) {
if(!a || obj->tri[a].tex!=obj->tri[a-1].tex) {
glBindTexture(GL_TEXTURE_2D,texture[obj->tri[a].tex]);
glEnable(GL_TEXTURE_2D);
}
glBegin(GL_TRIANGLES);
glTexCoord2f(obj->vt[obj->tri[a].vt1].u,obj->vt[obj->tri[a].vt1].v);
glNormal3f(obj->vn[obj->tri[a].vn1].x,obj->vn[obj->tri[a].vn1].y,obj->vn[obj->tri[a].vn1].z);
glVertex3f(obj->v[obj->tri[a].v1].x,obj->v[obj->tri[a].v1].y,obj->v[obj->tri[a].v1].z);
glTexCoord2f(obj->vt[obj->tri[a].vt2].u,obj->vt[obj->tri[a].vt2].v);
glNormal3f(obj->vn[obj->tri[a].vn2].x,obj->vn[obj->tri[a].vn2].y,obj->vn[obj->tri[a].vn2].z);
glVertex3f(obj->v[obj->tri[a].v2].x,obj->v[obj->tri[a].v2].y,obj->v[obj->tri[a].v2].z);
glTexCoord2f(obj->vt[obj->tri[a].vt3].u,obj->vt[obj->tri[a].vt3].v);
glNormal3f(obj->vn[obj->tri[a].vn3].x,obj->vn[obj->tri[a].vn3].y,obj->vn[obj->tri[a].vn3].z);
glVertex3f(obj->v[obj->tri[a].v3].x,obj->v[obj->tri[a].v3].y,obj->v[obj->tri[a].v3].z);
glEnd();
}
This renders objects correctly, but I am going to need to implement vertex buffer objects or whatever the most recent thing is. However, I will also need to implement skeletal animation.
All of the tutorials that I find do not do anything at a low level in C, and they make use of various libraries. Since I am using a custom format, though, these libraries will not be of much use.
Can anyone link to a simple tutorial that can explain this? What must be done is simple. There are two bones. The first bone rotates the entire object, while the second bone rotates half of the object. Skinning is to be used so some vertices from the second object stay at the end of the first object, like a snake.
A simple example using an object composed of two rectangles and with all of the values hard-coded will do. Thanks!