1
Graphics / Re: Drawing in 2D causes 3D to disappear
« on: January 29, 2013, 04:48:09 am »Isn't it normal for the screen to be cleared if you use glClear?
I'm new to OpenGL so I'm not sure, it was just something I saw in other solutions so I thought I'd try it. I've left it commented out though.
Also, you should (probably) use pushGLStates and popGLStates, as shown in the second example in the sf::RenderWindow documentation.
This doesn't appear to be available in SFML 1.6, but there is the similar function PreserveOpenGLStates which I'm assuming does the same thing. I'm not using it though because tutorials advise against it due to performance and instead suggest maintaining the state yourself: http://www.sfml-dev.org/tutorials/1.6/graphics-window.php.
Code: [Select]
Preserving OpenGL states is very CPU consuming and will degrade performances, use it only if you really need it. Also consider using your own code to manage the states you need to preserve...
Edit: Adding GetWindow().PreserveOpenGLStates(true); did the trick but in that case I guess the question now is how would I go about managing the state myself in order to increase performance?
Edit2: Looked at this thread where someone suggested using SFML 2.0 instead and having now looked at the 2.0 tutorial on using OpenGL with the Window I think I'm going to upgrade and follow the tutorial.