SFML community forums

Help => Graphics => Topic started by: Jim70 on January 29, 2016, 10:20:33 am

Title: Drawing SFML alongside opengl 3+ ?
Post 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();
Title: Re: Drawing SFML alongside opengl 3+ ?
Post by: Hapax on February 01, 2016, 12:29:51 am
Does this help:

Quote
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).
Title: Re: Drawing SFML alongside opengl 3+ ?
Post by: Elias Daler on March 29, 2016, 03:00:04 pm
I don't quite understand this part:
Quote
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?
Title: AW: Drawing SFML alongside opengl 3+ ?
Post by: eXpl0it3r on March 29, 2016, 03:21:52 pm
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.
Title: Re: Drawing SFML alongside opengl 3+ ?
Post by: Elias Daler on March 30, 2016, 08:34:11 am
Thanks for the info!