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

From OpenGL Wiki
Jump to navigation Jump to 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)

I tried using gl3.h on Windows 7 x86 with opengl32.lib and it worked! It seems the problem above is due to some incompatibility of gl3.h with x64 systems. But gl3.h did not work on linux x86 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:17, 19 February 2011 (CST)