hi,

i am new to opengl and graphics programming, basically i have loaded in a MD2 file and stored the model as an array. what i would like to know is how would i go about animating key frames.

some information on how i set up the model.

// declared the model as an array
CGModel     *myModel[4];


//heres where i loop through the models in the array
// Setup and load example model
for (int i=0; i<4; i++){
myModel = new CGModel();
importMD2("Assets\\Models\\Beast.md2", myModel,i+1);


// and in the render scene this is where i load my model
// Render model
myModel[0]->attachTextureImage("Assets\\Textures\\texture1.bmp");
myModel[0]->renderTexturedModel();

i dont know where i go from here? all i need is a basic animation of the model walking. any help would be very much appriciated

thanks in advance

What library/code are you using to import / render the MDL? because that's more than just opengl.

If the library you're using doesn't have the facility to load / render animation from MDL files, you'll have alot of work to do: if working from scratch, you have to read the animation data ( probably a list of times and updated vertex positions, or a list of times and matrices if the model uses 'skinned' animation ) then, in each frame, interpolate either the vertices or the matrices and update the positions that you're rendering. This is not an easy task and is particularly difficult to make efficient, even if you've written the rest of the model loading code (or even defined the entire model format) yourself and know exactly what data is involved.

thanks matt, im using a file from school that was written to load in md2 files by the teachers.

does anyone have a simple to follow example of how to do what matt said? thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.