Edit: Adding GetWindow().PreserveOpenGLStates(true); after initializing the RenderWindow and removing the commented section of the code blow resolved the issue although the wiki mentions that the function is
bad for performance (Bottom of the page).
Edit2: Ok, found that SFML 2.0 (I was using 1.6) has a good explanation on managing the states so I think this issue is solved unless anyone wants to add anything.
http://www.sfml-dev.org/tutorials/2.0/window-opengl.phpI've looked around the Web on how to draw a HUD over 3D views using OpenGL but the solutions have found have not been successful for me.
In the code below, with the lines commented the cube renders fine. With the depth disabling I get a weird semi-drawn cube. And with the buffer clear I get nothing. I've tried moving things around and pushing / poping but they have had no effect. The Render2D function draws some text using sf::String which also makes any previous 3D rendering disappear.
GetWindow().SetActive();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
Render3D();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, GetWindow().GetWidth() , GetWindow().GetHeight() , 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//glDisable(GL_DEPTH_TEST);
//glDepthMask(GL_FALSE);
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//Render2D();
Window->Display();
Some of the topics I found:
http://www.gamedev.net/topic/388298-opengl-hud/http://stackoverflow.com/questions/5467218/opengl-2d-hud-over-3dhttp://stackoverflow.com/questions/8370537/opengl-2d-hud-in-3d-applicationGoogle SearchAny help on what obvious thing I'm forgetting to do would be appreciated.