SDL 1.3 and GLEW

@Fugitive: A little tutorial is available here. I just update this wiki page and add a link on the doxygen documentation.

I plan to write an example using SDL/glut and of course expand the documentation.

It won’t run on C++ Builder 2010 Trial Version.


Error: Declaration syntax error

in gl.h:
WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value);

When doing it manually (without glew, gle etc), the last time I had that conflict was when I tried to include both gl3.h and gl.h at the same time…

This errror is typical when windows.h file is not included before the gl headers (for the symbol WINGDIAPI and APIENTRY).

In the beginning of gle/gle.hpp (included by gle/gl.h), you can find :

#ifdef WIN32

    #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
    #define WIN32_LEAN_AND_MEAN 1
    #ifndef NOMINMAX
    #define NOMINMAX
    #endif
    #include <windows.h> // contains all WGL Functions.
    #endif
    #include <GL/gl.h>
    #include <GL/glext.h>
    #include <GL/wglext.h>
    //#include <GL/glu.h>

#elif MACOSX

    #define WINGDIAPI
    #define APIENTRY
    #include <GL/gl.h>
    #include <GL/glext.h>
    //#include <GL/glu.h>
    //#include <OpenGL/gl.h>
    //#include <OpenGL/glext.h>
    //#include <OpenGL/glu.h>

#else // POSIX

    #define __STDC_VERSION__        199901L
    #include <GL/gl.h>
    #include <GL/glext.h>
    //#include <GL/glx.h>
    //#include <GL/glxext.h>
    //#include <GL/glu.h>

#endif

So I suspect that the symbol WIN32 is not defined by Turbo C++. Try to add it to the project settings to fix this problem.

^I thought that I wouldnt have to re-include windows.h since it was already included as you pointed out. Anyhow, I did include it at the top, so thats fine.

It still doesnt recognize the class functions though. It could be that it doesnt recognize the dll that I converted to Borland format via implib, though I have not had much problems with doing that in the past.


gle::OpenGLExtensionsGen gleContext(std::cout); <== problem
gleContext.initialize();
gle::gleSetCurrent( gleContext );

[BCC32 Error] tutorialMain.cpp(109): E2285 Could not find a match for ‘gle::OpenGLExtensionsGen::OpenGLExtensionsGen(ostream)’

It still doesnt recognize the class functions though. It could be that it doesnt recognize the dll that I converted to Borland format via implib, though I have not had much problems with doing that in the past.

This is a problem at compilation stage and not at the linking stage. So the dll produced by implib has no influence.
Have you included the file OpenGLExtensionsGen.hpp using #include <gle/OpenGLExtensionsGen.hpp> ?

Hi,

SDL and glew work fine together. You just have to specify which version of OpenGL you want to use before calling SDL_Init.

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_Init(SDL_INIT_VIDEO);

SDL_CreateWindow();
SDL_GL_CreateContext();

glewInit();

The tutorial (Tutorial2: VAOs, VBOs, Vertex and Fragment Shaders (C / SDL) - OpenGL Wiki) does not work because it creates a 2.1 OpenGL context and not a 3.2 as planned.

How exactly glew works?
After idwakest code, will I get only opengl 3.2 set of functions? Or all supported by driver?

Eg. how to get OGL4.1 (Core Profile if possible), with SDL and with glew.