SFML community forums

Help => General => Topic started by: arrognz on August 12, 2018, 05:41:11 pm

Title: [C++][OpenGL] How to get compatibility profile for GLSL 3.3
Post by: arrognz on August 12, 2018, 05:41:11 pm
Hello everyone :)

I'm using SFML to open a RenderWindow and I would like to use raw openGL to draw 3d graphics.
I'm calling glewInit() after the RenderWindow has been opened.
I'm not using sf::Shader.

Unfortunately, I get this message :

(click to show/hide)

And here are a few GL infos I print :

(click to show/hide)

My question is this: Is it possible to get a compatible profile to use the SFML graphics module for 2d rendering (for user interface mostly) AND openGL shaders using GLSL version 3.3 or above ?
Maybe it's not possible and SFML is not ready to support both ? In which case I suppose I should just open a simple sfml window ?

Thank you for your help :)

EDIT:

If you really want to use OpenGL 3.3 core on your system some steps are necessary:
  • Don't use anything in sfml-graphics, this includes sf::Shader. sfml-graphics contexts are by default always compatibility. You will have to do everything yourself in raw OpenGL.
  • On your system you have to make sure that you are not using any compatibility contexts. This means no sfml-graphics and explicitly having to activate the context of your window after creation.
  • Always make sure that your window is activated after you create it. If you don't explicitly do this you might end up using a context you didn't create, which is not going to be 3.3 core.

I saw that post and I'm not sure I understand. Does it mean that there's no way to use both graphics-module and my own opengl code/shaders ?

Also I just did a simple test: Using a sf::Window instead of sf::RenderWindow doesn't change anything. I get the same core context for requesting version 3.3.
Title: Re: [C++][OpenGL] How to get compatibility profile for GLSL 3.3
Post by: Hapax on August 14, 2018, 01:17:40 am
Is your intention to use 3.3 core because the first message suggests that you're attempting to use 3.3 "not-core".