PDA

View Full Version : Problem loading more than one 3d model in openGL



Diana
10-01-2010, 06:19 AM
Hi,

I am doing this project in openGL which uses milkshape model.
my problem is that I cann't seem to load more than 1 model at the same time...

The project written in C# (all the openGL functions are modiffied from c++ to fit c#, and I know there's no problem there) and it uses a MilkshapeModel class.

Here is a sample of the drawing code:

GL.glTranslatef(0.17f, 0.75f, 0f);
GL.glScaled(0.015, 0.015, 0.015);
fig1.DrawModel();
GL.glTranslatef(-0.17f, -0.75f, 0f);

GL.glTranslatef(0.17f, 0.75f, 0f);
GL.glScaled(0.015, 0.015, 0.015);
fig2.DrawModel();
GL.glTranslatef(-0.17f, -0.75f, 0f);

In the constructor I did:

fig1 = King(@"King1.MS3D");
fig2 = King(@"King2.MS3D");

King is a class inherited from MilkshapeModel class.

I think may be there is some think that writes to the same place and prevents me from loading the two models together, because echo one separately loads fine...

I'll be glad for some help

diana

BionicBytes
10-01-2010, 12:20 PM
I'm not sure what your problem is because you say you can't load more than one model but then you list OpenGL rendering code????

Diana
10-01-2010, 03:27 PM
what i meant the first model is display in the window and the second not... as far as i check both are loaded d created as an object

BionicBytes
10-02-2010, 03:37 PM
Your problem is that between rendering each model you need to use glpushmatrix and glpopmatrix to preserve the current modelview matrix.