SFML community forums
Help => Window => Topic started by: eglomer on June 04, 2015, 09:50:46 pm
-
Hi!
I'm trying to draw some 2D elements mixed with some 3D elements using OpenGL 3.3, but 2D elements never appears in the screen.
I prepared a full example to test this issue:
http://pastebin.com/BvJbK5K9
Some info:
- SFML: I tried it with version 2.1 and 2.3 with the same result.
- OS: Win7 64b (but game is compiled in x86).
Can anybody help me to make this works?
Thanks!!
-
Please provide a minimal complete example (http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368). Remove all the code (e.g. shaders) that's not required to reproduce the problem.
And read the documentation about resetGlStates() once more.
-
Removing shaders would be a pretty bad idea considering he wants to use the 3.3 core profile...
-
Hi Nexus.
I think that this is a very minimal example that fits to my game structure and shows that 2D elements are not appearing in the screen. There are only three functions to draw a 3D triangle and a 2D shape, and one of them is just to compile shaders, so you can ignore it. Furthermore, as SpeCter said, I think that is not a good idea remove shaders using OpenGL 3.3. ;D
And about resetGlStates(), it doesn't matter if you put or not this function; you will get the same result (in this case). I just put it in one of my tests.
Regards!
-
resetGLStates() only bothers setting states that SFML itself "knows about" which only covers legacy states at the moment (up to circa OpenGL 1.2 + shaders). You will have to manually restore any "modern GL states" to their default values before rendering with SFML's graphics module. In this specific case, you aren't unbinding your VAO or VBO before trying to render with SFML's graphics module, which does not understand/use VAOs/VBOs.