No 'progress' but a little finding, with the following:
// Display
{
Display * g_Display = XOpenDisplay( ":0" );
EGLint iMajorVersion, iMinorVersion;
if ( ! g_Display )
{
printf( "Failed to XOpenDisplay( \":0\" )\n" );
_exit( 1 );
}
g_EglDisplay = eglGetDisplay( ( NativeDisplayType ) g_Display );
if (g_EglDisplay == EGL_NO_DISPLAY)
{
printf( "Failed to eglGetDisplay\n" );
_exit( 1 );
}
if ( ! eglInitialize( g_EglDisplay, &iMajorVersion, &iMinorVersion ) )
{
printf( "eglInitialize failed\n" );
_exit( 1 );
}
}
flags = SDL_SWSURFACE;
bitDepth = 16;
// SDL
if ((surface = SDL_SetVideoMode(Width, Height, bitDepth, flags)) == NULL) {
fprintf(stderr, "(OpenGL) SDL SetVideoMode failed: %s\n", SDL_GetError());
exit(EXIT_FAILURE);
}
// EGL
{
SDL_SysWMinfo sysInfo; //Will hold our Window information
EGLint pi32ConfigAttribs[5];
int attrib = 0;
int iConfigs;
EGLConfig eglConfig;
int result = 0;
pi32ConfigAttribs[attrib++] = EGL_SURFACE_TYPE;
pi32ConfigAttribs[attrib++] = EGL_WINDOW_BIT;
pi32ConfigAttribs[attrib++] = EGL_NONE;
pi32ConfigAttribs[attrib++] = EGL_NONE;
if ( ! eglChooseConfig( g_EglDisplay, pi32ConfigAttribs, &eglConfig, 1, &iConfigs) || (iConfigs != 1))
{
printf( "eglChooseConfig failed\n" );
_exit( 1 );
}
g_EglContext = eglCreateContext( g_EglDisplay, eglConfig, NULL, NULL );
if (g_EglContext == EGL_NO_CONTEXT)
{
printf( "eglCreateContext failed\n" );
_exit( 1 );
}
// Get the SDL window handle
SDL_VERSION(&sysInfo.version); //Set SDL version
if(SDL_GetWMInfo(&sysInfo) <= 0)
{
printf( "EGL ERROR: Unable to get SDL window handle: %s\n", SDL_GetError() );
_exit( 1 );
}
g_Window = (NativeWindowType)sysInfo.info.x11.window;
g_EglSurface = eglCreateWindowSurface( g_EglDisplay, eglConfig, (NativeWindowType)g_Window, NULL );
if ( g_EglDisplay == EGL_NO_SURFACE )
{
printf( "eglCreateWindowSurface failed\n" );
_exit( 1 );
}
result = eglMakeCurrent( g_EglDisplay, g_EglSurface, g_EglSurface, g_EglContext );
if (result != EGL_TRUE)
{
printf( "EGL ERROR: Unable to make GLES context current\n" );
_exit( 1 );
}
// TEST
eglSwapBuffers( g_EglDisplay, g_EglSurface );
eglSwapBuffers( g_EglDisplay, g_EglSurface );
}
It will hang when I attempt to step over the first eglSwapBuffers call, which indicates it isn't a bad draw command or something hanging the GPU, as nothing is being drawn. There must be something not quite right with the EGL set up which is resulting in the eglSwapBuffers causing the hang.
The above code is pieced together from various sources of using EGL/SDL together, I'm sure I am missing something, but I can't quite figure it out right now..!