Well yeh. The title says it all. I hope this is getting changed when the new graphics API comes because it's like try and error to get it working.
First and foremost, it was like if not all values were being saved, I have to implement my own "Graphics::Context::State" class to keep track of the values that were not properly set which was back face culling and setting polygon mode to only render lines(wireframe).
This behaviour can be replicated by just adding this to the opengl example:
glEnable( GL_CULL_FACE );
glCullFace( GL_BACK );
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
No sprite nor text will be shown when these is enabled. Commenting out glPolygonMode so we do a fill instead of a line between vertexes will still not render any sprite or text. Doing the same with culling but leaving glPolygonMode on will make it so that only a wire frame for the sprite and text is shown. Shouldn't Save/Restore - GLStates handle this so that these values are properly set?
Like I said would be much nicer if we had some cleaner more secure way to do this. Maybe some kind of state class? So we can save away several states and then push them into the render target?
Something like this:
sf::State stateFor2D = window.GetDefaultState();
sf::State stateFor3D = stateFor2D;
stateFor3D.SetWireframe( true ); // Not that wireframe is useful in 2D rendering but the only value that came to mind right now.
// Set some more values for our 3D view.
window.SetState( stateFor3D );
// Render 3D
window.SetState( stateFor2D );
// Render 2D
window.Display();
NOTE: After thinking about it, this ain't needed just need to force ALL values in SaveGLStates to be values that SFML drawables expect and then reverse it in RestoreGLStates. Though I feel this approach would be nicer actually.
I don't know if I'm missing some vital point here or something? Just me getting annoyed that I have to try-and-error my way trough to get it working.
Also having another problem that might be related to this but not sure quite yet so I'm holding it off for the time being.