4 * Freeglut state query methods.
6 * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
7 * Written by Pawel W. Olszta, <olszta@sourceforge.net>
8 * Creation date: Thu Dec 16 1999
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include <GL/freeglut.h>
29 #include "freeglut_internal.h"
32 * TODO BEFORE THE STABLE RELEASE:
34 * glutGet() -- X11 tests passed, but check if all enums
35 * handled (what about Win32?)
36 * glutDeviceGet() -- X11 tests passed, but check if all enums
37 * handled (what about Win32?)
38 * glutGetModifiers() -- OK, but could also remove the limitation
39 * glutLayerGet() -- what about GLUT_NORMAL_DAMAGED?
41 * The fail-on-call policy will help adding the most needed things imho.
44 /* -- LOCAL DEFINITIONS ---------------------------------------------------- */
46 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
48 #if TARGET_HOST_POSIX_X11
50 * Queries the GL context about some attributes
52 static int fghGetConfig( int attribute )
55 int result; /* Not checked */
57 if( fgStructure.CurrentWindow )
58 result = glXGetFBConfigAttrib( fgDisplay.Display,
59 *(fgStructure.CurrentWindow->Window.FBConfig),
67 /* Check if the window is in full screen state. */
68 static int fghCheckFullScreen(void)
70 #if TARGET_HOST_POSIX_X11
75 if (fgDisplay.StateFullScreen != None)
77 result = fgHintPresent(fgStructure.CurrentWindow->Window.Handle,
79 fgDisplay.StateFullScreen);
91 /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
94 * General settings assignment method
96 void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
98 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetOption" );
101 * XXX In chronological code add order. (WHY in that order?)
105 case GLUT_INIT_WINDOW_X:
106 fgState.Position.X = (GLint)value;
109 case GLUT_INIT_WINDOW_Y:
110 fgState.Position.Y = (GLint)value;
113 case GLUT_INIT_WINDOW_WIDTH:
114 fgState.Size.X = (GLint)value;
117 case GLUT_INIT_WINDOW_HEIGHT:
118 fgState.Size.Y = (GLint)value;
121 case GLUT_INIT_DISPLAY_MODE:
122 fgState.DisplayMode = (unsigned int)value;
125 case GLUT_ACTION_ON_WINDOW_CLOSE:
126 fgState.ActionOnWindowClose = value;
129 case GLUT_RENDERING_CONTEXT:
130 fgState.UseCurrentContext =
131 ( value == GLUT_USE_CURRENT_CONTEXT ) ? GL_TRUE : GL_FALSE;
134 case GLUT_DIRECT_RENDERING:
135 fgState.DirectContext = value;
138 case GLUT_WINDOW_CURSOR:
139 if( fgStructure.CurrentWindow != NULL )
140 fgStructure.CurrentWindow->State.Cursor = value;
144 fgState.AuxiliaryBufferNumber = value;
147 case GLUT_MULTISAMPLE:
148 fgState.SampleNumber = value;
152 fgWarning( "glutSetOption(): missing enum handle %d", eWhat );
157 #if TARGET_HOST_MS_WINDOWS
158 /* The following include file is available from SGI but is not standard:
159 * #include <GL/wglext.h>
160 * So we copy the necessary parts out of it to support the multisampling query
162 #define WGL_SAMPLES_ARB 0x2042
167 * General settings query method
169 int FGAPIENTRY glutGet( GLenum eWhat )
171 #if TARGET_HOST_MS_WINDOWS
173 GLboolean boolValue ;
180 case GLUT_INIT_STATE:
181 return fgState.Initialised;
183 case GLUT_ELAPSED_TIME:
184 return fgElapsedTime();
187 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGet" );
189 /* XXX In chronological code add order. (WHY in that order?) */
192 /* Following values are stored in fgState and fgDisplay global structures */
193 case GLUT_SCREEN_WIDTH: return fgDisplay.ScreenWidth ;
194 case GLUT_SCREEN_HEIGHT: return fgDisplay.ScreenHeight ;
195 case GLUT_SCREEN_WIDTH_MM: return fgDisplay.ScreenWidthMM ;
196 case GLUT_SCREEN_HEIGHT_MM: return fgDisplay.ScreenHeightMM;
197 case GLUT_INIT_WINDOW_X: return fgState.Position.Use ?
198 fgState.Position.X : -1 ;
199 case GLUT_INIT_WINDOW_Y: return fgState.Position.Use ?
200 fgState.Position.Y : -1 ;
201 case GLUT_INIT_WINDOW_WIDTH: return fgState.Size.Use ?
202 fgState.Size.X : -1 ;
203 case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Use ?
204 fgState.Size.Y : -1 ;
205 case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ;
206 case GLUT_INIT_MAJOR_VERSION: return fgState.MajorVersion ;
207 case GLUT_INIT_MINOR_VERSION: return fgState.MinorVersion ;
208 case GLUT_INIT_FLAGS: return fgState.ContextFlags ;
209 case GLUT_INIT_PROFILE: return fgState.ContextProfile ;
211 #if TARGET_HOST_POSIX_X11
213 * The window/context specific queries are handled mostly by
216 case GLUT_WINDOW_NUM_SAMPLES:
217 #ifdef GLX_VERSION_1_3
218 glGetIntegerv(GL_SAMPLES, &nsamples);
223 * The rest of GLX queries under X are general enough to use a macro to
226 # define GLX_QUERY(a,b) case a: return fghGetConfig( b );
228 GLX_QUERY( GLUT_WINDOW_RGBA, GLX_RGBA );
229 GLX_QUERY( GLUT_WINDOW_DOUBLEBUFFER, GLX_DOUBLEBUFFER );
230 GLX_QUERY( GLUT_WINDOW_BUFFER_SIZE, GLX_BUFFER_SIZE );
231 GLX_QUERY( GLUT_WINDOW_STENCIL_SIZE, GLX_STENCIL_SIZE );
232 GLX_QUERY( GLUT_WINDOW_DEPTH_SIZE, GLX_DEPTH_SIZE );
233 GLX_QUERY( GLUT_WINDOW_RED_SIZE, GLX_RED_SIZE );
234 GLX_QUERY( GLUT_WINDOW_GREEN_SIZE, GLX_GREEN_SIZE );
235 GLX_QUERY( GLUT_WINDOW_BLUE_SIZE, GLX_BLUE_SIZE );
236 GLX_QUERY( GLUT_WINDOW_ALPHA_SIZE, GLX_ALPHA_SIZE );
237 GLX_QUERY( GLUT_WINDOW_ACCUM_RED_SIZE, GLX_ACCUM_RED_SIZE );
238 GLX_QUERY( GLUT_WINDOW_ACCUM_GREEN_SIZE, GLX_ACCUM_GREEN_SIZE );
239 GLX_QUERY( GLUT_WINDOW_ACCUM_BLUE_SIZE, GLX_ACCUM_BLUE_SIZE );
240 GLX_QUERY( GLUT_WINDOW_ACCUM_ALPHA_SIZE, GLX_ACCUM_ALPHA_SIZE );
241 GLX_QUERY( GLUT_WINDOW_STEREO, GLX_STEREO );
245 /* Colormap size is handled in a bit different way than all the rest */
246 case GLUT_WINDOW_COLORMAP_SIZE:
247 if( (fghGetConfig( GLX_RGBA )) || (fgStructure.CurrentWindow == NULL) )
250 * We've got a RGBA visual, so there is no colormap at all.
251 * The other possibility is that we have no current window set.
257 const GLXFBConfig * fbconfig =
258 fgStructure.CurrentWindow->Window.FBConfig;
260 XVisualInfo * visualInfo =
261 glXGetVisualFromFBConfig( fgDisplay.Display, *fbconfig );
263 const int result = visualInfo->visual->map_entries;
271 * Those calls are somewhat similiar, as they use XGetWindowAttributes()
276 case GLUT_WINDOW_BORDER_WIDTH:
277 case GLUT_WINDOW_HEADER_HEIGHT:
282 if( fgStructure.CurrentWindow == NULL )
285 XTranslateCoordinates(
287 fgStructure.CurrentWindow->Window.Handle,
288 fgDisplay.RootWindow,
293 case GLUT_WINDOW_X: return x;
294 case GLUT_WINDOW_Y: return y;
299 XTranslateCoordinates(
301 fgStructure.CurrentWindow->Window.Handle,
302 w, 0, 0, &x, &y, &w);
306 case GLUT_WINDOW_BORDER_WIDTH: return x;
307 case GLUT_WINDOW_HEADER_HEIGHT: return y;
311 case GLUT_WINDOW_WIDTH:
312 case GLUT_WINDOW_HEIGHT:
314 XWindowAttributes winAttributes;
316 if( fgStructure.CurrentWindow == NULL )
318 XGetWindowAttributes(
320 fgStructure.CurrentWindow->Window.Handle,
325 case GLUT_WINDOW_WIDTH: return winAttributes.width ;
326 case GLUT_WINDOW_HEIGHT: return winAttributes.height ;
330 /* I do not know yet if there will be a fgChooseVisual() function for Win32 */
331 case GLUT_DISPLAY_MODE_POSSIBLE:
333 /* We should not have to call fgChooseFBConfig again here. */
334 GLXFBConfig * fbconfig;
337 fbconfig = fgChooseFBConfig();
339 if (fbconfig == NULL)
352 /* This is system-dependant */
353 case GLUT_WINDOW_FORMAT_ID:
354 if( fgStructure.CurrentWindow == NULL )
357 return fghGetConfig( GLX_VISUAL_ID );
359 #elif TARGET_HOST_MS_WINDOWS
361 case GLUT_WINDOW_NUM_SAMPLES:
362 glGetIntegerv(WGL_SAMPLES_ARB, &nsamples);
365 /* Handle the OpenGL inquiries */
366 case GLUT_WINDOW_RGBA:
367 glGetBooleanv ( GL_RGBA_MODE, &boolValue );
368 returnValue = boolValue ? 1 : 0;
370 case GLUT_WINDOW_DOUBLEBUFFER:
371 glGetBooleanv ( GL_DOUBLEBUFFER, &boolValue );
372 returnValue = boolValue ? 1 : 0;
374 case GLUT_WINDOW_STEREO:
375 glGetBooleanv ( GL_STEREO, &boolValue );
376 returnValue = boolValue ? 1 : 0;
379 case GLUT_WINDOW_RED_SIZE:
380 glGetIntegerv ( GL_RED_BITS, &returnValue );
382 case GLUT_WINDOW_GREEN_SIZE:
383 glGetIntegerv ( GL_GREEN_BITS, &returnValue );
385 case GLUT_WINDOW_BLUE_SIZE:
386 glGetIntegerv ( GL_BLUE_BITS, &returnValue );
388 case GLUT_WINDOW_ALPHA_SIZE:
389 glGetIntegerv ( GL_ALPHA_BITS, &returnValue );
391 case GLUT_WINDOW_ACCUM_RED_SIZE:
392 glGetIntegerv ( GL_ACCUM_RED_BITS, &returnValue );
394 case GLUT_WINDOW_ACCUM_GREEN_SIZE:
395 glGetIntegerv ( GL_ACCUM_GREEN_BITS, &returnValue );
397 case GLUT_WINDOW_ACCUM_BLUE_SIZE:
398 glGetIntegerv ( GL_ACCUM_BLUE_BITS, &returnValue );
400 case GLUT_WINDOW_ACCUM_ALPHA_SIZE:
401 glGetIntegerv ( GL_ACCUM_ALPHA_BITS, &returnValue );
403 case GLUT_WINDOW_DEPTH_SIZE:
404 glGetIntegerv ( GL_DEPTH_BITS, &returnValue );
407 case GLUT_WINDOW_BUFFER_SIZE:
408 returnValue = 1 ; /* ????? */
410 case GLUT_WINDOW_STENCIL_SIZE:
411 returnValue = 0 ; /* ????? */
416 case GLUT_WINDOW_WIDTH:
417 case GLUT_WINDOW_HEIGHT:
420 * There is considerable confusion about the "right thing to
421 * do" concerning window size and position. GLUT itself is
422 * not consistent between Windows and UNIX/X11; since
423 * platform independence is a virtue for "freeglut", we
424 * decided to break with GLUT's behaviour.
426 * Under UNIX/X11, it is apparently not possible to get the
427 * window border sizes in order to subtract them off the
428 * window's initial position until some time after the window
429 * has been created. Therefore we decided on the following
430 * behaviour, both under Windows and under UNIX/X11:
431 * - When you create a window with position (x,y) and size
432 * (w,h), the upper left hand corner of the outside of the
433 * window is at (x,y) and the size of the drawable area is
435 * - When you query the size and position of the window--as
436 * is happening here for Windows--"freeglut" will return
437 * the size of the drawable area--the (w,h) that you
438 * specified when you created the window--and the coordinates
439 * of the upper left hand corner of the drawable
440 * area--which is NOT the (x,y) you specified.
445 freeglut_return_val_if_fail( fgStructure.CurrentWindow != NULL, 0 );
448 * We need to call GetWindowRect() first...
449 * (this returns the pixel coordinates of the outside of the window)
451 GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect );
453 /* ...then we've got to correct the results we've just received... */
455 #if !defined(_WIN32_WCE)
456 if ( ( fgStructure.GameModeWindow != fgStructure.CurrentWindow ) && ( fgStructure.CurrentWindow->Parent == NULL ) &&
457 ( ! fgStructure.CurrentWindow->IsMenu ) )
459 winRect.left += GetSystemMetrics( SM_CXSIZEFRAME );
460 winRect.right -= GetSystemMetrics( SM_CXSIZEFRAME );
461 winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
462 winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
464 #endif /* !defined(_WIN32_WCE) */
468 case GLUT_WINDOW_X: return winRect.left ;
469 case GLUT_WINDOW_Y: return winRect.top ;
470 case GLUT_WINDOW_WIDTH: return winRect.right - winRect.left;
471 case GLUT_WINDOW_HEIGHT: return winRect.bottom - winRect.top;
476 case GLUT_WINDOW_BORDER_WIDTH :
477 #if defined(_WIN32_WCE)
480 return GetSystemMetrics( SM_CXSIZEFRAME );
481 #endif /* !defined(_WIN32_WCE) */
483 case GLUT_WINDOW_HEADER_HEIGHT :
484 #if defined(_WIN32_WCE)
487 return GetSystemMetrics( SM_CYCAPTION );
488 #endif /* defined(_WIN32_WCE) */
490 case GLUT_DISPLAY_MODE_POSSIBLE:
491 #if defined(_WIN32_WCE)
494 return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
496 #endif /* defined(_WIN32_WCE) */
499 case GLUT_WINDOW_FORMAT_ID:
500 #if !defined(_WIN32_WCE)
501 if( fgStructure.CurrentWindow != NULL )
502 return GetPixelFormat( fgStructure.CurrentWindow->Window.Device );
503 #endif /* defined(_WIN32_WCE) */
508 /* The window structure queries */
509 case GLUT_WINDOW_PARENT:
510 if( fgStructure.CurrentWindow == NULL ) return 0;
511 if( fgStructure.CurrentWindow->Parent == NULL ) return 0;
512 return fgStructure.CurrentWindow->Parent->ID;
514 case GLUT_WINDOW_NUM_CHILDREN:
515 if( fgStructure.CurrentWindow == NULL )
517 return fgListLength( &fgStructure.CurrentWindow->Children );
519 case GLUT_WINDOW_CURSOR:
520 if( fgStructure.CurrentWindow == NULL )
522 return fgStructure.CurrentWindow->State.Cursor;
524 case GLUT_MENU_NUM_ITEMS:
525 if( fgStructure.CurrentMenu == NULL )
527 return fgListLength( &fgStructure.CurrentMenu->Entries );
529 case GLUT_ACTION_ON_WINDOW_CLOSE:
530 return fgState.ActionOnWindowClose;
533 return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH;
535 case GLUT_RENDERING_CONTEXT:
536 return fgState.UseCurrentContext ? GLUT_USE_CURRENT_CONTEXT
537 : GLUT_CREATE_NEW_CONTEXT;
539 case GLUT_DIRECT_RENDERING:
540 return fgState.DirectContext;
542 case GLUT_FULL_SCREEN:
543 return fghCheckFullScreen();
546 return fgState.AuxiliaryBufferNumber;
548 case GLUT_MULTISAMPLE:
549 return fgState.SampleNumber;
552 fgWarning( "glutGet(): missing enum handle %d", eWhat );
559 * Returns various device information.
561 int FGAPIENTRY glutDeviceGet( GLenum eWhat )
563 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDeviceGet" );
565 /* XXX WARNING: we are mostly lying in this function. */
568 case GLUT_HAS_KEYBOARD:
570 * Win32 is assumed a keyboard, and this cannot be queried,
571 * except for WindowsCE.
573 * X11 has a core keyboard by definition, although it can
574 * be present as a virtual/dummy keyboard. For now, there
575 * is no reliable way to tell if a real keyboard is present.
577 #if defined(_WIN32_CE)
578 return ( GetKeyboardStatus() & KBDI_KEYBOARD_PRESENT ) ? 1 : 0;
579 # if FREEGLUT_LIB_PRAGMAS
580 # pragma comment (lib,"Kbdui.lib")
587 #if TARGET_HOST_POSIX_X11
589 /* X11 has a mouse by definition */
593 case GLUT_NUM_MOUSE_BUTTONS:
594 /* We should be able to pass NULL when the last argument is zero,
595 * but at least one X server has a bug where this causes a segfault.
597 * In XFree86/Xorg servers, a mouse wheel is seen as two buttons
598 * rather than an Axis; "freeglut_main.c" expects this when
599 * checking for a wheel event.
603 int nbuttons = XGetPointerMapping(fgDisplay.Display, &map,0);
607 #elif TARGET_HOST_MS_WINDOWS
611 * MS Windows can be booted without a mouse.
613 return GetSystemMetrics( SM_MOUSEPRESENT );
615 case GLUT_NUM_MOUSE_BUTTONS:
616 # if defined(_WIN32_WCE)
619 return GetSystemMetrics( SM_CMOUSEBUTTONS );
623 case GLUT_HAS_JOYSTICK:
624 return fgJoystickDetect ();
626 case GLUT_OWNS_JOYSTICK:
627 return fgState.JoysticksInitialised;
629 case GLUT_JOYSTICK_POLL_RATE:
630 return fgStructure.CurrentWindow ? fgStructure.CurrentWindow->State.JoystickPollRate : 0;
632 /* XXX The following two are only for Joystick 0 but this is an improvement */
633 case GLUT_JOYSTICK_BUTTONS:
634 return glutJoystickGetNumButtons ( 0 );
636 case GLUT_JOYSTICK_AXES:
637 return glutJoystickGetNumAxes ( 0 );
639 case GLUT_HAS_DIAL_AND_BUTTON_BOX:
640 return fgInputDeviceDetect ();
643 if ( fgState.InputDevsInitialised ) return 8;
646 case GLUT_NUM_BUTTON_BOX_BUTTONS:
649 case GLUT_HAS_SPACEBALL:
650 case GLUT_HAS_TABLET:
653 case GLUT_NUM_SPACEBALL_BUTTONS:
654 case GLUT_NUM_TABLET_BUTTONS:
657 case GLUT_DEVICE_IGNORE_KEY_REPEAT:
658 return fgStructure.CurrentWindow ? fgStructure.CurrentWindow->State.IgnoreKeyRepeat : 0;
660 case GLUT_DEVICE_KEY_REPEAT:
661 return fgState.KeyRepeat;
664 fgWarning( "glutDeviceGet(): missing enum handle %d", eWhat );
668 /* And now -- the failure. */
673 * This should return the current state of ALT, SHIFT and CTRL keys.
675 int FGAPIENTRY glutGetModifiers( void )
677 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetModifiers" );
678 if( fgState.Modifiers == INVALID_MODIFIERS )
680 fgWarning( "glutGetModifiers() called outside an input callback" );
684 return fgState.Modifiers;
688 * Return the state of the GLUT API overlay subsystem. A misery ;-)
690 int FGAPIENTRY glutLayerGet( GLenum eWhat )
692 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutLayerGet" );
695 * This is easy as layers are not implemented ;-)
697 * XXX Can we merge the UNIX/X11 and WIN32 sections? Or
698 * XXX is overlay support planned?
703 #if TARGET_HOST_POSIX_X11
705 case GLUT_OVERLAY_POSSIBLE:
708 case GLUT_LAYER_IN_USE:
711 case GLUT_HAS_OVERLAY:
714 case GLUT_TRANSPARENT_INDEX:
716 * Return just anything, which is always defined as zero
722 case GLUT_NORMAL_DAMAGED:
723 /* XXX Actually I do not know. Maybe. */
726 case GLUT_OVERLAY_DAMAGED:
729 #elif TARGET_HOST_MS_WINDOWS
731 case GLUT_OVERLAY_POSSIBLE:
732 /* return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
733 PFD_OVERLAY_PLANE ); */
736 case GLUT_LAYER_IN_USE:
739 case GLUT_HAS_OVERLAY:
742 case GLUT_TRANSPARENT_INDEX:
744 * Return just anything, which is always defined as zero
750 case GLUT_NORMAL_DAMAGED:
751 /* XXX Actually I do not know. Maybe. */
754 case GLUT_OVERLAY_DAMAGED:
759 fgWarning( "glutLayerGet(): missing enum handle %d", eWhat );
763 /* And fail. That's good. Programs do love failing. */
767 int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size)
771 #if TARGET_HOST_POSIX_X11
773 GLXFBConfig * fbconfigArray; /* Array of FBConfigs */
774 int fbconfigArraySize; /* Number of FBConfigs in the array */
775 int attribute_name = 0;
778 FREEGLUT_EXIT_IF_NOT_INITIALISED("glutGetModeValues");
785 #if TARGET_HOST_POSIX_X11
787 case GLUT_MULTISAMPLE:
789 attributes[0] = GLX_BUFFER_SIZE;
790 attributes[1] = GLX_DONT_CARE;
796 FBConfigs are now sorted by increasing number of auxiliary
797 buffers. We want at least one buffer.
799 attributes[2] = GLX_AUX_BUFFERS;
801 attributes[4] = None;
803 attribute_name = GLX_AUX_BUFFERS;
808 case GLUT_MULTISAMPLE:
809 attributes[2] = GLX_AUX_BUFFERS;
810 attributes[3] = GLX_DONT_CARE;
811 attributes[4] = GLX_SAMPLE_BUFFERS;
814 FBConfigs are now sorted by increasing number of samples per
815 pixel. We want at least one sample.
817 attributes[6] = GLX_SAMPLES;
819 attributes[8] = None;
821 attribute_name = GLX_SAMPLES;
826 fbconfigArray = glXChooseFBConfig(fgDisplay.Display,
831 if (fbconfigArray != NULL)
834 int result; /* Returned by glXGetFBConfigAttrib. Not checked. */
838 temp_array = malloc(sizeof(int) * fbconfigArraySize);
841 for (i = 0; i < fbconfigArraySize; i++)
845 result = glXGetFBConfigAttrib(fgDisplay.Display,
849 if (value > previous_value)
851 temp_array[*size] = value;
852 previous_value = value;
857 array = malloc(sizeof(int) * (*size));
858 for (i = 0; i < *size; i++)
860 array[i] = temp_array[i];
864 XFree(fbconfigArray);
877 /*** END OF FILE ***/