SFML community forums

Help => Window => Topic started by: Zuzu_Typ on July 26, 2016, 06:22:44 pm

Title: Confusion with modern OpenGL
Post by: Zuzu_Typ on July 26, 2016, 06:22:44 pm
Dear community,

so is it possible to use modern OpenGL with SFML?

If so, how do you do it?

I don't seem to be able to get my code running, not creating a context with GLEW.

I even tried using the SFML-core attribute in the ContextSettings, but that didn't change anything.

So if I don't use my own GLEW context the program crashes at
Code: [Select]
glBindTexture(GL_TEXTURE_2D, 0);
Is it supposed to crash here or did I do a mistake somewhere?

I am using mostly modified code from learn-opengl.com .

Thank you for your time and help,
--Zuzu_Typ--
Title: Re: Confusion with modern OpenGL
Post by: binary1248 on July 26, 2016, 06:36:19 pm
You need to get your terminology right...

SFML is the one who provides you with a functioning OpenGL context, corresponding to the version/flags you specify.
GLEW is the one who provides you with the function entry points you use to call into OpenGL.

GLEW relies on a context being available and active to function correctly as well. It does not provide you with a context.

Without GLEW you will only be able to use the entry points that are exposed by your system headers. This limits you to OpenGL 1.1 on Windows and depending on your distribution, anything between 1.1 and 1.3 on Linux. Using GLEW or some other extension loader is mandatory if you want to use modern OpenGL.

If you include the GLEW header and call one of the OpenGL functions without first loading them, it will result in undefined behaviour.
Title: Re: Confusion with modern OpenGL
Post by: jamesL on August 01, 2016, 11:08:54 am
here's some good tutorials on Modern OpenGL
they use GLFW for window management and glew to get opengl extensions
but I guess you can figure out how to convert it to SFML
 
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/

http://learnopengl.com/#!Getting-started/Hello-Triangle

http://www.codeincodeblock.com/2013/07/modern-opengl-32-tutorial-series-with.html

SFML with OpenGL is very confusing to me
I think GLFW with Glad is much easier

in my opinion, SFML beats SDL and GLFW in just about every area except OpenGL
there are much better web page tutorials and examples on youtube for then with OpenGL