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

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

0 Members and 1 Guest are viewing this topic.

Zuzu_Typ

  • 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,
--Zuzu_Typ--
« Last Edit: July 26, 2016, 06:24:47 pm by Zuzu_Typ »

binary1248

  • 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).

jamesL

  • 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
 
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

 

anything