Okey, I''ve made a program which renders stuff

. And in my render function I have a switch between perspective and ortho mode. These functions look like this:
void COpenGL::StartOrthoMode(int width, int height)
{
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, width, 0, height, -1, 1);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glEnable(GL_TEXTURE_2D);
glPolygonMode(GL_FRONT, GL_FILL);
glPolygonMode(GL_BACK, GL_FILL);
}
-----------------------------------------------
void COpenGL::EndOrthoMode()
{
glDisable(GL_BLEND);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
}
But then in my render function which looks like this:
void CGame::MenuRender()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
// ***************************************
// DRAW 2D
// ***************************************
m_pOpenGL->StartOrthoMode(WINDOW_WIDTH, WINDOW_HEIGHT);
// Print some text
m_pOpenGL->EndOrthoMode();
// ****************************************
// END DRAW 2D
// ****************************************
}
If I try to render something outside StartOrthoMode() and EndOrthoMode() it won''t get rendered... so that is my problem.
And this is my resize function:
bool CApplication::ResizeScene(int width, int height)
{
// Prevent a divide by zero
if(height == 0)
{
height = 1;
}
// Reset current view
glViewport(0,0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Calculate the aspect ratio of the window
gluPerspective(45.0f, (GLfloat)width/(GLfloat)height, 0.1f, 1000.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
return true;
}
So what can be wrong with my changes, and how do I fix it? Thank you very much and keep up the good work!
CUselessStuff::NiftyQuote();