I wrote an md2 class, based on nehe’s. When I goto run it I dont see the md2 but, I see everything else just fine. I read threw the md2 code and im 100% its not that. What is wrong is something with how I set up glut. There is something wrong with the reshape funtion, init, or draw. Ill post all of them.
void init()
{
axy.x = 0.0f;
axy.y = 0.0f;
axy.z = -25.0f;if(ng.LoadTexture(“jon.bmp”, texture, 0) == 0)
{
cout << "Texture loading failed
";
}if(ng.LoadTexture(“alien.bmp”, texture, 1) == 0)
{
cout << "Texture loading failed
";
}glShadeModel(GL_SMOOTH); // Enable Smooth Shading glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background glClearDepth(1.0f); // Depth Buffer Setup glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL); glEnable(GL_LIGHT0); // Quick And Dirty Lighting (Assumes Light0 Is Set Up) glEnable(GL_LIGHTING); // Enable Lighting glEnable(GL_COLOR_MATERIAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}static void Reshape(int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 1000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, 40.0);
}static void Draw()
{
static GLfloat move = 0.0;
ng.Clear();glPushMatrix();
glPushMatrix();
ng.SetColor(RGB(0.0, 1.0, 1.0));
ng.MoveAxis(XYZ(-2.5, 0, -20));
ng.RotateAllAxis(move);
ng.Sphere(0.275, 32, 32);
glPopMatrix();glPushMatrix();
ng.SetColor(RGB(0.0f, 1.0f, 0.0f));
ng.MoveAxis(XYZ(-2.5, 0, -20));
ng.RotateAxis(XYZ(move + 270, move, move));
ng.WireRing(0.275, 0.85, 10, 30);
glPopMatrix();glPushMatrix();
ng.SetColor(RGB(0.0f, 0.0f, 1.0f));
ng.MoveAxis(XYZ(-2.5, 0, -20));
ng.RotateAllAxis(move);
ng.WireRing(0.275, 0.85, 10, 30);
glPopMatrix();glEnable(GL_TEXTURE_2D);
glPushMatrix();
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[0]);
ng.SetColor(RGB(1.0, 1.0, 1.0));
ng.MoveAxis(XYZ(3.0, 0.0, -60.0));
ng.RotateAllAxis(move);
ng.Cube();
glPopMatrix();glBindTexture(GL_TEXTURE_2D, texture[1]);
ng.MoveAxis(axy);
glScalef(0.5, 0.5, 0.5);
md2.Animate(md2.StateStart, md2.StateEnd, 0.2);
glBindTexture(GL_TEXTURE_2D, texture[1]);
md2.Animate(md2.StateStart, md2.StateEnd, 0.2);glFlush();
glDisable(GL_TEXTURE_2D);
move += 1.0f;
glutSwapBuffers();
}
Please help.
Thanks,
Nuke
P.S I am using Linux.