First if you look at your code, perspective is only called on resize, now if never change your perspective that would work fine.
But you don’t, you change it to ortho in the drawscene routine and since resize is only called on window resize ortho mode is the only thing being used, except of one pass after a resize and perspective is used.
You need to move your perspective setup from the resize routine and put it in the display routine so it is called every time.
void Drawscene(void)
{
// Setup perspective
// Draw stuff
// change to ortho
// Draw head display.
}
int InitGL(GLvoid)
{
BuildFont();
if ((!LoadTGA(&textures[0],“data/Font.tga”))
)
{
return FALSE;
}
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_FLAT);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
//glPolygonMode(GL_FRONT, GL_LINE);
//glPolygonMode(GL_BACK, GL_LINE);
level_0.Load(“level.txt”);
return TRUE;
}
int DrawGLScene(GLvoid)
{
CalculateFrameRate();
speed = kSpeed * g_FrameInterval;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
Keyboard();
mcamera.drawCamera();
level_0.Render();
fps();
glPushMatrix();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0f,1024,768,0.0f,-1.0f,1.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPopMatrix();
return TRUE;
}
GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window
{
if (height==0) // Prevent A Divide By Zero By
{
height=1; // Making Height Equal One
}
glViewport(0,0,width,height); // Reset The Current Viewport
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
}
i just get a blank screen[/b]<HR></BLOCKQUOTE>
[This message has been edited by nexusone (edited 05-08-2003).]