/*
- * freeglut_init_x11.c
+ * fg_init_x11.c
*
* Various freeglut initialization functions.
*
if( fgDisplay.pDisplay.Display == NULL )
fgError( "failed to open display '%s'", XDisplayName( displayName ) );
+ if ( fgState.XSyncSwitch )
+ XSynchronize(fgDisplay.pDisplay.Display, True);
+
#ifdef EGL_VERSION_1_0
fghPlatformInitializeEGL();
#else
if( !glXQueryExtension( fgDisplay.pDisplay.Display, NULL, NULL ) )
fgError( "OpenGL GLX extension not supported by display '%s'",
XDisplayName( displayName ) );
+
+ /* This forces AMD Catalyst drivers to initialize and register a shutdown
+ * function, which must be done before our own call to atexit to prevent
+ * a crash if glutMainLoop is not called or is not exited cleanly.
+ * (see bug #206)
+ */
+ glXQueryExtensionsString( fgDisplay.pDisplay.Display,
+ DefaultScreen( fgDisplay.pDisplay.Display ));
#endif
fgDisplay.pDisplay.Screen = DefaultScreen( fgDisplay.pDisplay.Display );