Original Post
I am working on the rendering code for our engine and I am having problems with rastering non-geometric objects such as bitmpas and fonts. The pipeline code is as follows:
glLoadIdentity();
glPushMatrix();
// position the camera
gluLookAt(wnd->GetCamera()->m_position.x, wnd->GetCamera()->m_position.y,
wnd->GetCamera()->m_position.z, wnd->GetCamera()->m_view.x,
wnd->GetCamera()->m_view.y, wnd->GetCamera()->m_view.z, wnd->GetCamera()->m_up.x,
wnd->GetCamera()->m_up.y, wnd->GetCamera()->m_up.z);
wnd->DrawGrid();
glPushMatrix();
// move to the center of the camera view
glTranslatef(wnd->GetCamera()->m_view.x, 0, wnd->GetCamera()->m_view.z);
auxSolidSphere(0.5);
glPopMatrix();
glPopMatrix();
// Prepare to draw 2D
RECT window;
GetClientRect(wnd->GetHWND(), &window);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, window.right, window.bottom, 0, 0.1f, 2);
glMatrixMode(GL_MODELVIEW);
wnd->GetParentGUI()->Draw();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glFlush();
float secs = wnd->GetTimer().GetElapsedSeconds();
// bring back buffer to the foreground
SwapBuffers(wnd->GetHDC());
When I attempt to add a segment of code that, for example, draws a cursor within the ortho portion of the pipeline... it fails to draw to the screen.
glPushMatrix();
glLoadIdentity();
glOrtho(0, window.right, window.bottom, 0, 0.1f, 2);
glMatrixMode(GL_MODELVIEW);
wnd->GetParentGUI()->Draw();
glRasterPos2f(100, 100);
glDrawPixels(g_cursor.width, g_cursor.height, GL_RGB, GL_UNSIGNED_BYTE, g_cursor.data);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
I have tested various z-depths (all of which are within the fustrum), as well as multiple x , y positions and also rastering with glRasterPos3f() but none seem to work...