Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Confusion with modern OpenGL  (Read 2220 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 3
    • View Profile
Confusion with modern OpenGL
« 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,
« Last Edit: July 26, 2016, 06:24:47 pm by Zuzu_Typ »


  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Confusion with modern OpenGL
« Reply #1 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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).


  • Full Member
  • ***
  • Posts: 124
    • View Profile
Re: Confusion with modern OpenGL
« Reply #2 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



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