Talk:Tutorial1: Creating a Cross Platform OpenGL 3.2 Context in SDL (C / SDL)

From OpenGL Wiki
Jump to: navigation, search

Not fully comaptible with Win32?

I tested this tutorial using Visual Studio 2008 under Win7 x64. It seems that the GL3.h is not compatible with Windows. Microsofts OpenGL32.lib is AFAIK a OpenGL 1.1 version. This should be the problem that the linker can't find the symbols of the newer functions such as glGenBuffers().

Then I thought I could replace the gl3.h with glew.h. After that the code compiles fine but I only get a compatibility profile context. This Tutorial 1 works but Tutorial 2 (using VBOs) fails because of access violations whenaccessing the OpenGL 3.2 core profile functions. -- Michaelvs 14:50, 13 March 2010 (UTC)

I found the problem why it was not working. I forgot to call glewInit() after the context creation.
To make the tutorial compatible with the windows platform you have to include glew.h (part of GLEW Library instead of gl3.h (which seems not to be compatible with the OpenGL32.lib of Windows). And then call glewInit() (see the Tutorial at GLEW Website) after calling SDL_GL_createContext(). -- Michaelvs 15:17, 13 March 2010 (UTC)

gl3.h incompatibilities with Linux

gl3.h did not work on linux for me. And it did not work in a very weird way: all calls to glClearColor produced only a green color no matter what color I specified. In any case it seems that we should be using GLEW instead of gl3.h and I have updated the tutorial to that effect. --Sunnyps 13:19, 19 February 2011 (CST)

Incorrect SDL compilation parameters and version note

1. The tutorial speaks of SDL 1.2 or 1.3 but it's actually using SDL2 with SDL_Window for example. In the gcc therefore you must put gcc [...] $(sdl2-config --cflags --libs)

2. To the note above, I used #include <GLES3/gl3.h> instead

3. I also had to change:

void checkSDLError(int line = -1)


void checkSDLError(int line)