* and the window rect from the client area given the style of the window
* (or a valid window pointer from which the style can be queried).
*/
-extern void fghGetClientArea( RECT *clientRect, const SFG_Window *window, BOOL wantPosOutside );
+extern void fghGetClientArea( RECT *clientRect, const SFG_Window *window );
extern void fghGetStyleFromWindow( const SFG_Window *window, DWORD *windowStyle, DWORD *windowExStyle );
extern void fghComputeWindowRectFromClientArea_UseStyle( RECT *clientRect, const DWORD windowStyle, const DWORD windowExStyle, BOOL posIsOutside );
return returnValue;
case GLUT_WINDOW_BUFFER_SIZE:
- returnValue = 1 ; /* TODO????? */
- return returnValue;
+ {
+ PIXELFORMATDESCRIPTOR pfd;
+ HDC hdc = fgStructure.CurrentWindow->Window.pContext.Device;
+ int iPixelFormat = GetPixelFormat( hdc );
+ DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+
+ returnValue = pfd.cColorBits;
+ if (pfd.iPixelType==PFD_TYPE_RGBA)
+ returnValue += pfd.cAlphaBits;
+
+ return returnValue;
+ }
case GLUT_WINDOW_STENCIL_SIZE:
- returnValue = 0 ; /* TODO????? */
+ glGetIntegerv ( GL_STENCIL_BITS, &returnValue );
return returnValue;
case GLUT_WINDOW_X:
/* Get style of window, or default style */
fghGetStyleFromWindow( fgStructure.CurrentWindow, &windowStyle, &windowExStyle );
- /* Get client area if any window */
+ /* Get client area if we have a current window, else use dummy rect */
+ /* Also get window rect (including non-client area) */
if (fgStructure.CurrentWindow && fgStructure.CurrentWindow->Window.Handle)
- fghGetClientArea(&clientRect,fgStructure.CurrentWindow,FALSE);
+ {
+ fghGetClientArea(&clientRect,fgStructure.CurrentWindow);
+ GetWindowRect(fgStructure.CurrentWindow->Window.Handle,&winRect);
+ }
else
+ {
SetRect(&clientRect,0,0,200,200);
-
- /* Compute window rect (including non-client area) */
- CopyRect(&winRect,&clientRect);
- fghComputeWindowRectFromClientArea_UseStyle(&winRect,windowStyle,windowExStyle,FALSE);
+ CopyRect(&winRect,&clientRect);
+ fghComputeWindowRectFromClientArea_UseStyle(&winRect,windowStyle,windowExStyle,FALSE);
+ }
/* Calculate border width by taking width of whole window minus width of client area and divide by two
* NB: we assume horizontal and vertical borders have the same size, which should always be the case