*/\r
typedef Window SFG_WindowHandleType ;\r
typedef GLXContext SFG_WindowContextType ;\r
+typedef struct tagSFG_PlatformContext SFG_PlatformContext;\r
+struct tagSFG_PlatformContext\r
+{\r
+ GLXFBConfig* FBConfig; /* The window's FBConfig */\r
+};\r
+\r
\r
\r
#endif\r
SFG_WindowHandleType Handle; /* The window's handle */\r
SFG_WindowContextType Context; /* The window's OpenGL/WGL context */\r
\r
-#if TARGET_HOST_POSIX_X11\r
- GLXFBConfig* FBConfig; /* The window's FBConfig */\r
-#elif TARGET_HOST_MS_WINDOWS\r
- HDC Device; /* The window's device context */\r
-#endif\r
+ SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */\r
\r
int DoubleBuffered; /* Treat the window as double-buffered */\r
};\r
\r
if( fgStructure.CurrentWindow )\r
result = glXGetFBConfigAttrib( fgDisplay.Display,\r
- *(fgStructure.CurrentWindow->Window.FBConfig),\r
+ *(fgStructure.CurrentWindow->Window.pContext.FBConfig),\r
attribute,\r
&returnValue );\r
\r
else\r
{\r
const GLXFBConfig * fbconfig =\r
- fgStructure.CurrentWindow->Window.FBConfig;\r
+ fgStructure.CurrentWindow->Window.pContext.FBConfig;\r
\r
XVisualInfo * visualInfo =\r
glXGetVisualFromFBConfig( fgDisplay.Display, *fbconfig );\r
#if TARGET_HOST_POSIX_X11\r
void fgPlatformCreateWindow ( SFG_Window *window )\r
{\r
- window->Window.FBConfig = NULL;\r
+ window->Window.pContext.FBConfig = NULL;\r
\r
window->State.OldHeight = window->State.OldWidth = -1;\r
}\r
\r
/* "classic" context creation */\r
Display *dpy = fgDisplay.Display;\r
- GLXFBConfig config = *(window->Window.FBConfig);\r
+ GLXFBConfig config = *(window->Window.pContext.FBConfig);\r
int render_type = ( !menu && index_mode ) ? GLX_COLOR_INDEX_TYPE : GLX_RGBA_TYPE;\r
GLXContext share_list = NULL;\r
Bool direct = ( fgState.DirectContext != GLUT_FORCE_INDIRECT_CONTEXT );\r
if( window->IsMenu && ( ! fgStructure.MenuContext ) )\r
fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB ;\r
\r
- window->Window.FBConfig = fgChooseFBConfig( &num_FBConfigs );\r
+ window->Window.pContext.FBConfig = fgChooseFBConfig( &num_FBConfigs );\r
\r
if( window->IsMenu && ( ! fgStructure.MenuContext ) )\r
fgState.DisplayMode = current_DisplayMode ;\r
\r
- if( ! window->Window.FBConfig )\r
+ if( ! window->Window.pContext.FBConfig )\r
{\r
/*\r
* The "fgChooseFBConfig" returned a null meaning that the visual\r
if( !( fgState.DisplayMode & GLUT_DOUBLE ) )\r
{\r
fgState.DisplayMode |= GLUT_DOUBLE ;\r
- window->Window.FBConfig = fgChooseFBConfig( &num_FBConfigs );\r
+ window->Window.pContext.FBConfig = fgChooseFBConfig( &num_FBConfigs );\r
fgState.DisplayMode &= ~GLUT_DOUBLE;\r
}\r
\r
if( fgState.DisplayMode & GLUT_MULTISAMPLE )\r
{\r
fgState.DisplayMode &= ~GLUT_MULTISAMPLE ;\r
- window->Window.FBConfig = fgChooseFBConfig( &num_FBConfigs );\r
+ window->Window.pContext.FBConfig = fgChooseFBConfig( &num_FBConfigs );\r
fgState.DisplayMode |= GLUT_MULTISAMPLE;\r
}\r
}\r
\r
- FREEGLUT_INTERNAL_ERROR_EXIT( window->Window.FBConfig != NULL,\r
+ FREEGLUT_INTERNAL_ERROR_EXIT( window->Window.pContext.FBConfig != NULL,\r
"FBConfig with necessary capabilities not found", "fgOpenWindow" );\r
\r
/* Get the X visual. */\r
for (i = 0; i < num_FBConfigs; i++) {\r
visualInfo = glXGetVisualFromFBConfig( fgDisplay.Display,\r
- window->Window.FBConfig[i] );\r
+ window->Window.pContext.FBConfig[i] );\r
if (visualInfo)\r
break;\r
}\r
{\r
if( window->Window.Context )\r
glXDestroyContext( fgDisplay.Display, window->Window.Context );\r
- XFree( window->Window.FBConfig );\r
+ XFree( window->Window.pContext.FBConfig );\r
\r
if( window->Window.Handle ) {\r
XDestroyWindow( fgDisplay.Display, window->Window.Handle );\r
\r
void fgPlatformGlutSwapBuffers( SFG_PlatformDisplay *pDisplayPtr, SFG_Window* CurrentWindow )\r
{\r
- SwapBuffers( CurrentWindow->Window.Device );\r
+ SwapBuffers( CurrentWindow->Window.pContext.Device );\r
}\r
*/\r
typedef HWND SFG_WindowHandleType ;\r
typedef HGLRC SFG_WindowContextType ;\r
+typedef struct tagSFG_PlatformContext SFG_PlatformContext;\r
+struct tagSFG_PlatformContext\r
+{\r
+ HDC Device; /* The window's device context */\r
+};\r
+\r
\r
\r
\r
"fgPlatformWindowProc" );\r
\r
window->Window.Handle = hWnd;\r
- window->Window.Device = GetDC( hWnd );\r
+ window->Window.pContext.Device = GetDC( hWnd );\r
if( window->IsMenu )\r
{\r
unsigned int current_DisplayMode = fgState.DisplayMode;\r
fgState.DisplayMode = current_DisplayMode;\r
\r
if( fgStructure.MenuContext )\r
- wglMakeCurrent( window->Window.Device,\r
+ wglMakeCurrent( window->Window.pContext.Device,\r
fgStructure.MenuContext->MContext\r
);\r
else\r
fgStructure.MenuContext =\r
(SFG_MenuContext *)malloc( sizeof(SFG_MenuContext) );\r
fgStructure.MenuContext->MContext =\r
- wglCreateContext( window->Window.Device );\r
+ wglCreateContext( window->Window.pContext.Device );\r
}\r
\r
/* window->Window.Context = wglGetCurrentContext (); */\r
- window->Window.Context = wglCreateContext( window->Window.Device );\r
+ window->Window.Context = wglCreateContext( window->Window.pContext.Device );\r
}\r
else\r
{\r
\r
if( ! fgState.UseCurrentContext )\r
window->Window.Context =\r
- wglCreateContext( window->Window.Device );\r
+ wglCreateContext( window->Window.pContext.Device );\r
else\r
{\r
window->Window.Context = wglGetCurrentContext( );\r
if( ! window->Window.Context )\r
window->Window.Context =\r
- wglCreateContext( window->Window.Device );\r
+ wglCreateContext( window->Window.pContext.Device );\r
}\r
\r
#if !defined(_WIN32_WCE)\r
fgSetWindow( current_window );\r
}\r
\r
- ReleaseDC( window->Window.Handle, window->Window.Device );\r
+ ReleaseDC( window->Window.Handle, window->Window.pContext.Device );\r
\r
#if defined(_WIN32_WCE)\r
/* Take over button handling */\r
case GLUT_WINDOW_FORMAT_ID:\r
#if !defined(_WIN32_WCE)\r
if( fgStructure.CurrentWindow != NULL )\r
- return GetPixelFormat( fgStructure.CurrentWindow->Window.Device );\r
+ return GetPixelFormat( fgStructure.CurrentWindow->Window.pContext.Device );\r
#endif /* defined(_WIN32_WCE) */\r
return 0;\r
\r
return;\r
}\r
\r
- wglMakeCurrent( window->Window.Device, window->Window.Context );\r
+ wglMakeCurrent( window->Window.pContext.Device, window->Window.Context );\r
\r
- if ( !fghIsExtensionSupported( window->Window.Device, "WGL_ARB_create_context" ) )\r
+ if ( !fghIsExtensionSupported( window->Window.pContext.Device, "WGL_ARB_create_context" ) )\r
{\r
return;\r
}\r
fgError( "wglCreateContextAttribsARB not found" );\r
}\r
\r
- context = wglCreateContextAttribsARB( window->Window.Device, 0, attributes );\r
+ context = wglCreateContextAttribsARB( window->Window.pContext.Device, 0, attributes );\r
if ( context == NULL )\r
{\r
fghContextCreationError();\r
if (checkOnly)\r
current_hDC = CreateDC(TEXT("DISPLAY"), NULL ,NULL ,NULL);\r
else\r
- current_hDC = window->Window.Device;\r
+ current_hDC = window->Window.pContext.Device;\r
\r
fghFillPFD( ppfd, current_hDC, layer_type );\r
pixelformat = ChoosePixelFormat( current_hDC, ppfd );\r
{\r
if( fgStructure.CurrentWindow )\r
ReleaseDC( fgStructure.CurrentWindow->Window.Handle,\r
- fgStructure.CurrentWindow->Window.Device );\r
+ fgStructure.CurrentWindow->Window.pContext.Device );\r
\r
if ( window )\r
{\r
- window->Window.Device = GetDC( window->Window.Handle );\r
+ window->Window.pContext.Device = GetDC( window->Window.Handle );\r
wglMakeCurrent(\r
- window->Window.Device,\r
+ window->Window.pContext.Device,\r
window->Window.Context\r
);\r
}\r