/*
* The GLX context creation, possibly trying the direct context rendering
+ * or else use the current context if the user has so specified
*/
- window->Window.Context = glXCreateContext(
- fgDisplay.Display, window->Window.VisualInfo,
- NULL, fgState.ForceDirectContext | fgState.TryDirectContext
- );
+ if ( fgState.UseCurrentContext == TRUE )
+ {
+ window->Window.Context = glXGetCurrentContext();
+
+ if ( ! window->Window.Context )
+ window->Window.Context = glXCreateContext(
+ fgDisplay.Display, window->Window.VisualInfo,
+ NULL, fgState.ForceDirectContext | fgState.TryDirectContext
+ );
+ }
+ else
+ window->Window.Context = glXCreateContext(
+ fgDisplay.Display, window->Window.VisualInfo,
+ NULL, fgState.ForceDirectContext | fgState.TryDirectContext
+ );
/*
* Make sure the context is direct when the user wants it forced
# endif
}
-#elif TARGET_HOST_WIN32
+#elif TAR
+GET_HOST_WIN32
WNDCLASS wc;
int flags;
h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 + GetSystemMetrics( SM_CYCAPTION );
}
+
/*
* Check if the user wants us to use the default position/size
*/
if( fgState.Position.Use == FALSE ) { x = CW_USEDEFAULT; y = CW_USEDEFAULT; }
- if( fgState.Size .Use == FALSE ) { w = CW_USEDEFAULT; h = CW_USEDEFAULT; }
+
+ if( fgState.Size .Use == FALSE ) { w = CW_USEDEFAULT; h = CW_USEDEFAULT; }
- /*
+
+ /*
* There's a small difference between creating the top, child and game mode windows
*/
flags = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE;
else
flags |= WS_CHILD;
}
+
else
{
/*
flags = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE;
}
+
/*
* Create the window now, passing the freeglut window structure as the parameter
*/
glReadBuffer ( GL_FRONT ) ;
}
+
/*
* Set the newly created window as the current one
*/
fgSetWindow( window );
}
+
/*
* Closes a window, destroying the frame and OpenGL context
*/
}
+
/* -- INTERFACE FUNCTIONS -------------------------------------------------- */
/*
fgState.Size.X, fgState.Size.Y, FALSE )->ID );
}
+
/*
* This function creates a sub window.
*/
return( window->ID );
}
+
/*
* Destroys a window and all of its subwindows
*/
fgState.ExecState = ExecState ;
}
+
/*
* This function selects the current window
*/
return;
}
+
fgSetWindow ( window ) ;
}
+
/*
* This function returns the ID number of the current window, 0 if none exists
*/
return( 0 );
}
+
/*
* Otherwise, return the ID of the current window
*/
return( fgStructure.Window->ID );
}
+
/*
* This function makes the current window visible
*/
#endif
}
+
/*
* This function hides the current window
*/
*/
XWithdrawWindow( fgDisplay.Display, fgStructure.Window->Window.Handle, fgDisplay.Screen );
}
+
else
{
/*
XUnmapWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
}
+
/*
* Flush the X state now
*/
#endif
}
+
/*
* Iconify the current window (top-level windows only)
*/
#endif
}
+
/*
* Set the current window's title
*/
XFlush( fgDisplay.Display );
}
+
#elif TARGET_HOST_WIN32
/*
* This seems to be a bit easier under Win32
#endif
}
+
/*
* Set the current window's iconified title
*/
XFlush( fgDisplay.Display );
}
+
#elif TARGET_HOST_WIN32
/*
* This seems to be a bit easier under Win32
#endif
}
+
/*
* Change the current window's size
*/
width += GetSystemMetrics( SM_CXSIZEFRAME ) * 2;
height += GetSystemMetrics( SM_CYSIZEFRAME ) * 2 + GetSystemMetrics( SM_CYCAPTION );
}
+
else /* This is a subwindow, get the parent window's position and subtract it off */
{
GetWindowRect ( fgStructure.Window->Parent->Window.Handle, &winRect ) ;
y -= winRect.top + GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION ) ;
}
+
/*
* Resize the window, forcing a redraw to happen
*/
TRUE
);
}
+
#endif
}
+
/*
* Change the current window's position
*/
);
}
+
#endif
}
+
/*
* Lowers the current window (by Z order change)
*/
#endif
}
+
/*
* Raises the current window (by Z order change)
*/
#endif
}
+
/*
* Resize the current window so that it fits the whole screen
*/
);
}
+
/*
* A.Donev: Set and retrieve the window's user data
*/
return(fgStructure.Window->UserData);
}
+
void FGAPIENTRY glutSetWindowData(void* data)
{
fgStructure.Window->UserData=data;
}
-/*** END OF FILE ***/
-
-
-
-
-
-
-
-
+/*** END OF FILE ***/