EGL contexts with SDL initialization


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_SetVideoMode(200, 200, 0, SDL_OPENGL);

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

  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