PDA

View Full Version : EGL contexts with SDL initialization



azmeuk
05-02-2013, 05:17 AM
Hi.
When I initialize an OpenGL context with SDL 1.2, GLX is able to retrieve it, but EGL can't.

gcc -o egl egl.c -lX11 -lEGL -lSDL -lGL

#include <EGL/egl.h>
#include <GL/glx.h>
#include <SDL/SDL.h>

int main(){
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_SetVideoMode(200, 200, 0, SDL_OPENGL);

printf(eglGetCurrentContext() == EGL_NO_CONTEXT ? "EGL KO\n" : "EGL OK\n");
printf(glXGetCurrentContext() == NULL ? "GLX KO\n" : "GLX OK\n");

return 0;
}
This code displays "EGL KO" and "GLX OK"
Is it the expected behavior ? If it is, how can I retrieve the OpenGL context ?
Thanks for your help