SFML community forums
Help => Graphics => Topic started by: Jim70 on January 29, 2016, 10:20:33 am
-
It works fine with ogl 2, but it doesnt draw in opengl 3, why is that?
window.pushGLStates();
window.draw(sf::RectangleShape(sf::Vector2f(100, 100)));
window.popGLStates();
-
Does this help:
OpenGL versions above 3.0 are supported by SFML (as long as your graphics driver can handle them). Support for selecting the profile of 3.2+ contexts and whether the context debug flag is set was added in SFML 2.3. The forward compatibility flag is not supported. By default, SFML creates 3.2+ contexts using the compatibility profile because the graphics module makes use of legacy OpenGL functionality. If you intend on using the graphics module, make sure to create your context without the core profile setting or the graphics module will not function correctly. On OS X, SFML supports creating OpenGL 3.2+ contexts using the core profile only. If you want to use the graphics module on OS X, you are limited to using a legacy context which implies OpenGL version 2.1.
from the "Using OpenGL in a SFML window" tutorial (http://www.sfml-dev.org/tutorials/2.3/window-opengl.php#creating-an-opengl-window).
-
I don't quite understand this part:
make sure to create your context without the core profile setting or the graphics module will not function correctly
How can I do this? I'm using OpenGL 3.x with SFML and it looks like push/popGLStates doesn't help, so I have to clean up the state (then everything else works correctly)
Does it mean I have to do it or is there any other way to handle stuff?
-
That probably meant that some drivers (mostly on Linux) don't (or didn't) support non core contexts. You request core contexts with the ContextSettings when creating the window.
Also keep in mibd that SFML won't handle your OpenGL 3 states, so you'll have handle them yourself.
-
Thanks for the info!