You should also be pushing and popping the Modelview matrix...
void COpenGL::StartOrtho(int width, int height){ glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0, width, 0, height, -1, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); // ** NEW ** glLoadIdentity(); // ** NEW ** 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::EndOrtho(){ glDisable(GL_BLEND); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix();}
Also, as you''re now clipping with a volume as wide and high as the screen (eg 800.0 in X, and 600.0 in Y), maybe try to draw a larger triangle in the centre of the window...
glVertex2f(m_WindowConfig.width/2, m_WindowConfig.height/2);
glVertex2f(m_WindowConfig.width/2 + 10.0, m_WindowConfig.height/2);
glVertex2f(m_WindowConfig.width/2, m_WindowConfig.height/2 + 10);
Other than that, I can''t see anything that would stop your code from working. As a side note, do you realise that you have set you projection so that you must specify Y coordinate in your 2D mode starting from the
bottom of the window? (you may be aware of this, but just checking

)
The way to set it so you can specify coordinates in the same fashion as regular windowing-style coordinates (ie y=0 at the top) is:
glOrtho(0, width, height, 0, -1, 1);
Hope that helps you out