#define GLUT_ACTION_CONTINUE_EXECUTION 2
/*
+ * Create a new rendering context when the user opens a new window?
+ */
+#define GLUT_CREATE_NEW_CONTEXT 0
+#define GLUT_USE_CURRENT_CONTEXT 1
+
+/*
* GLUT API Extension macro definitions -- the glutGet parameters
*/
#define GLUT_ACTION_ON_WINDOW_CLOSE 0x01F9
#define GLUT_VERSION 0x01FC
+#define GLUT_RENDERING_CONTEXT 0x01FD
+
/*
* Process loop function, see freeglut_main.c
*/
FALSE, /* ForceDirectContext */
TRUE, /* TryDirectContext */
FALSE, /* ForceIconic */
+ FALSE, /* UseCurrentContext */
FALSE, /* GLDebugSwitch */
FALSE, /* XSyncSwitch */
TRUE, /* IgnoreKeyRepeat */
72, /* GameModeRefresh */
GLUT_ACTION_EXIT, /* ActionOnWindowClose */
GLUT_EXEC_STATE_INIT /* ExecState */
-};
+} ;
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
fgState.ForceDirectContext = FALSE;
fgState.TryDirectContext = TRUE;
fgState.ForceIconic = FALSE;
+ fgState.UseCurrentContext = FALSE;
fgState.GLDebugSwitch = FALSE;
fgState.XSyncSwitch = FALSE;
fgState.ActionOnWindowClose = GLUT_ACTION_EXIT ;
/* check if GLUT_FPS env var is set */
{
- const char *fps = getenv("GLUT_FPS");
- if (fps) {
- sscanf(fps, "%d", &fgState.FPSInterval);
- if (fgState.FPSInterval <= 0)
- fgState.FPSInterval = 5000; /* 5000 milliseconds */
- }
+ const char *fps = getenv ( "GLUT_FPS" );
+ if ( fps )
+ {
+ sscanf ( fps, "%d", &fgState.FPSInterval ) ;
+ if ( fgState.FPSInterval <= 0 )
+ fgState.FPSInterval = 5000 ; /* 5000 milliseconds */
+ }
}
/*
GLboolean TryDirectContext; /* What about giving a try to? */
GLboolean ForceIconic; /* All new top windows are iconified */
+ GLboolean UseCurrentContext; /* New windows use current window's rendering context */
GLboolean GLDebugSwitch; /* OpenGL state debugging switch */
GLboolean XSyncSwitch; /* X11 sync protocol switch */
Atom DeleteWindow; /* The window deletion atom */
#ifdef X_XF86VidModeGetModeLine
+ /*
+ * XF86VidMode may be compilable even if it fails at runtime. Therefore,
+ * the validity of the VidMode has to be tracked
+ */
+ int DisplayModeValid; /* Flag that indicates runtime status*/
XF86VidModeModeLine DisplayMode; /* Current screen's display settings */
int DisplayModeClock; /* The display mode's refresh rate */
#endif
fgSetupPixelFormat( window, FALSE, PFD_MAIN_PLANE );
/*
- * Create the OpenGL rendering context now
+ * Create or get the OpenGL rendering context now
*/
- window->Window.Context = wglCreateContext( window->Window.Device );
+ if ( fgState.UseCurrentContext == TRUE )
+ window->Window.Context = wglGetCurrentContext();
+ else
+ window->Window.Context = wglCreateContext( window->Window.Device );
/*
* Still, we'll be needing to explicitly resize the window
*/
if( fgStructure.Window == window )
{
+ int used = FALSE ;
+ SFG_Window *iter ;
+
wglMakeCurrent( NULL, NULL );
- wglDeleteContext( window->Window.Context );
+ /* Step through the list of windows. If the rendering context is notbeing used
+ * by another window, then we delete it.
+ */
+ for ( iter = fgStructure.Windows.First; iter; iter = iter->Node.Next )
+ {
+ if ( ( iter->Window.Context == window->Window.Context ) && ( iter != window ) )
+ used = TRUE ;
+ }
+
+ if ( used == FALSE ) wglDeleteContext( window->Window.Context );
}
/*
case GLUT_ACTION_ON_WINDOW_CLOSE: fgState.ActionOnWindowClose = value ;
break ;
+ case GLUT_RENDERING_CONTEXT: fgState.UseCurrentContext = ( value == GLUT_USE_CURRENT_CONTEXT ) ? TRUE : FALSE ;
+ break ;
+
case GLUT_WINDOW_CURSOR:
if( fgStructure.Window != NULL ) fgStructure.Window->State.Cursor = value ;
break ;
*/
int FGAPIENTRY glutGet( GLenum eWhat )
{
- int returnValue ;
- GLboolean boolValue ;
+ int returnValue ;
+ GLboolean boolValue ;
- if ( eWhat == GLUT_INIT_STATE )
- return ( fgState.Time.Set ) ;
+ if ( eWhat == GLUT_INIT_STATE )
+ return ( fgState.Time.Set ) ;
freeglut_assert_ready;
/*
* ...then we've got to correct the results we've just received...
*/
- if (fgStructure.GameMode != fgStructure.Window &&
- fgStructure.Window->Parent == NULL )
+ if ( ( fgStructure.GameMode != fgStructure.Window ) && ( fgStructure.Window->Parent == NULL ) )
{
winRect.left += GetSystemMetrics( SM_CXSIZEFRAME );
winRect.right -= GetSystemMetrics( SM_CXSIZEFRAME );
return( fgListLength( &fgStructure.Menu->Entries ) );
case GLUT_ACTION_ON_WINDOW_CLOSE:
- return fgState.ActionOnWindowClose;
+ return fgState.ActionOnWindowClose ;
+
+ case GLUT_VERSION :
+ return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH ;
- case GLUT_VERSION:
- return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH;
+ case GLUT_RENDERING_CONTEXT:
+ return ( fgState.UseCurrentContext ? GLUT_USE_CURRENT_CONTEXT : GLUT_CREATE_NEW_CONTEXT ) ;
default:
/*
/* This file has been automatically generated by the genstroke utility. */
#include "freeglut_internal.h"
-//#ifdef TARGET_HOST_WIN32
-//#pragma warning ( once:4305 )
-//#endif
+
/* char: 0x20 */
static const SFG_StrokeStrip ch32st[] =