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 /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
70 * General settings assignment method
72 void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
74 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetOption" );
77 * XXX In chronological code add order. (WHY in that order?)
81 case GLUT_INIT_WINDOW_X:
82 fgState.Position.X = (GLint)value;
85 case GLUT_INIT_WINDOW_Y:
86 fgState.Position.Y = (GLint)value;
89 case GLUT_INIT_WINDOW_WIDTH:
90 fgState.Size.X = (GLint)value;
93 case GLUT_INIT_WINDOW_HEIGHT:
94 fgState.Size.Y = (GLint)value;
97 case GLUT_INIT_DISPLAY_MODE:
98 fgState.DisplayMode = (unsigned int)value;
101 case GLUT_ACTION_ON_WINDOW_CLOSE:
102 fgState.ActionOnWindowClose = value;
105 case GLUT_RENDERING_CONTEXT:
106 fgState.UseCurrentContext =
107 ( value == GLUT_USE_CURRENT_CONTEXT ) ? GL_TRUE : GL_FALSE;
110 case GLUT_DIRECT_RENDERING:
111 fgState.DirectContext = value;
114 case GLUT_WINDOW_CURSOR:
115 if( fgStructure.CurrentWindow != NULL )
116 fgStructure.CurrentWindow->State.Cursor = value;
120 fgState.AuxiliaryBufferNumber = value;
123 case GLUT_MULTISAMPLE:
124 fgState.SampleNumber = value;
128 fgWarning( "glutSetOption(): missing enum handle %d", eWhat );
133 #if TARGET_HOST_MS_WINDOWS
134 /* The following include file is available from SGI but is not standard:
135 * #include <GL/wglext.h>
136 * So we copy the necessary parts out of it to support the multisampling query
138 #define WGL_SAMPLES_ARB 0x2042
143 * General settings query method
145 int FGAPIENTRY glutGet( GLenum eWhat )
147 #if TARGET_HOST_MS_WINDOWS
149 GLboolean boolValue ;
156 case GLUT_INIT_STATE:
157 return fgState.Initialised;
159 case GLUT_ELAPSED_TIME:
160 return fgElapsedTime();
163 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGet" );
165 /* XXX In chronological code add order. (WHY in that order?) */
168 /* Following values are stored in fgState and fgDisplay global structures */
169 case GLUT_SCREEN_WIDTH: return fgDisplay.ScreenWidth ;
170 case GLUT_SCREEN_HEIGHT: return fgDisplay.ScreenHeight ;
171 case GLUT_SCREEN_WIDTH_MM: return fgDisplay.ScreenWidthMM ;
172 case GLUT_SCREEN_HEIGHT_MM: return fgDisplay.ScreenHeightMM;
173 case GLUT_INIT_WINDOW_X: return fgState.Position.Use ?
174 fgState.Position.X : -1 ;
175 case GLUT_INIT_WINDOW_Y: return fgState.Position.Use ?
176 fgState.Position.Y : -1 ;
177 case GLUT_INIT_WINDOW_WIDTH: return fgState.Size.Use ?
178 fgState.Size.X : -1 ;
179 case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Use ?
180 fgState.Size.Y : -1 ;
181 case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ;
182 case GLUT_INIT_MAJOR_VERSION: return fgState.MajorVersion ;
183 case GLUT_INIT_MINOR_VERSION: return fgState.MinorVersion ;
184 case GLUT_INIT_FLAGS: return fgState.ContextFlags ;
185 case GLUT_INIT_PROFILE: return fgState.ContextProfile ;
187 #if TARGET_HOST_POSIX_X11
189 * The window/context specific queries are handled mostly by
192 case GLUT_WINDOW_NUM_SAMPLES:
193 #ifdef GLX_VERSION_1_3
194 glGetIntegerv(GL_SAMPLES, &nsamples);
199 * The rest of GLX queries under X are general enough to use a macro to
202 # define GLX_QUERY(a,b) case a: return fghGetConfig( b );
204 GLX_QUERY( GLUT_WINDOW_RGBA, GLX_RGBA );
205 GLX_QUERY( GLUT_WINDOW_DOUBLEBUFFER, GLX_DOUBLEBUFFER );
206 GLX_QUERY( GLUT_WINDOW_BUFFER_SIZE, GLX_BUFFER_SIZE );
207 GLX_QUERY( GLUT_WINDOW_STENCIL_SIZE, GLX_STENCIL_SIZE );
208 GLX_QUERY( GLUT_WINDOW_DEPTH_SIZE, GLX_DEPTH_SIZE );
209 GLX_QUERY( GLUT_WINDOW_RED_SIZE, GLX_RED_SIZE );
210 GLX_QUERY( GLUT_WINDOW_GREEN_SIZE, GLX_GREEN_SIZE );
211 GLX_QUERY( GLUT_WINDOW_BLUE_SIZE, GLX_BLUE_SIZE );
212 GLX_QUERY( GLUT_WINDOW_ALPHA_SIZE, GLX_ALPHA_SIZE );
213 GLX_QUERY( GLUT_WINDOW_ACCUM_RED_SIZE, GLX_ACCUM_RED_SIZE );
214 GLX_QUERY( GLUT_WINDOW_ACCUM_GREEN_SIZE, GLX_ACCUM_GREEN_SIZE );
215 GLX_QUERY( GLUT_WINDOW_ACCUM_BLUE_SIZE, GLX_ACCUM_BLUE_SIZE );
216 GLX_QUERY( GLUT_WINDOW_ACCUM_ALPHA_SIZE, GLX_ACCUM_ALPHA_SIZE );
217 GLX_QUERY( GLUT_WINDOW_STEREO, GLX_STEREO );
221 /* Colormap size is handled in a bit different way than all the rest */
222 case GLUT_WINDOW_COLORMAP_SIZE:
223 if( (fghGetConfig( GLX_RGBA )) || (fgStructure.CurrentWindow == NULL) )
226 * We've got a RGBA visual, so there is no colormap at all.
227 * The other possibility is that we have no current window set.
233 const GLXFBConfig * fbconfig =
234 fgStructure.CurrentWindow->Window.FBConfig;
236 XVisualInfo * visualInfo =
237 glXGetVisualFromFBConfig( fgDisplay.Display, *fbconfig );
239 const int result = visualInfo->visual->map_entries;
247 * Those calls are somewhat similiar, as they use XGetWindowAttributes()
252 case GLUT_WINDOW_BORDER_WIDTH:
253 case GLUT_WINDOW_HEADER_HEIGHT:
258 if( fgStructure.CurrentWindow == NULL )
261 XTranslateCoordinates(
263 fgStructure.CurrentWindow->Window.Handle,
264 fgDisplay.RootWindow,
269 case GLUT_WINDOW_X: return x;
270 case GLUT_WINDOW_Y: return y;
275 XTranslateCoordinates(
277 fgStructure.CurrentWindow->Window.Handle,
278 w, 0, 0, &x, &y, &w);
282 case GLUT_WINDOW_BORDER_WIDTH: return x;
283 case GLUT_WINDOW_HEADER_HEIGHT: return y;
287 case GLUT_WINDOW_WIDTH:
288 case GLUT_WINDOW_HEIGHT:
290 XWindowAttributes winAttributes;
292 if( fgStructure.CurrentWindow == NULL )
294 XGetWindowAttributes(
296 fgStructure.CurrentWindow->Window.Handle,
301 case GLUT_WINDOW_WIDTH: return winAttributes.width ;
302 case GLUT_WINDOW_HEIGHT: return winAttributes.height ;
306 /* I do not know yet if there will be a fgChooseVisual() function for Win32 */
307 case GLUT_DISPLAY_MODE_POSSIBLE:
309 /* We should not have to call fgChooseFBConfig again here. */
310 GLXFBConfig * fbconfig;
313 fbconfig = fgChooseFBConfig(NULL);
315 if (fbconfig == NULL)
328 /* This is system-dependant */
329 case GLUT_WINDOW_FORMAT_ID:
330 if( fgStructure.CurrentWindow == NULL )
333 return fghGetConfig( GLX_VISUAL_ID );
335 #elif TARGET_HOST_MS_WINDOWS
337 case GLUT_WINDOW_NUM_SAMPLES:
338 glGetIntegerv(WGL_SAMPLES_ARB, &nsamples);
341 /* Handle the OpenGL inquiries */
342 case GLUT_WINDOW_RGBA:
343 #if defined(_WIN32_WCE)
344 boolValue = (GLboolean)0; /* WinCE doesn't support this feature */
346 glGetBooleanv ( GL_RGBA_MODE, &boolValue );
347 returnValue = boolValue ? 1 : 0;
350 case GLUT_WINDOW_DOUBLEBUFFER:
351 #if defined(_WIN32_WCE)
352 boolValue = (GLboolean)0; /* WinCE doesn't support this feature */
354 glGetBooleanv ( GL_DOUBLEBUFFER, &boolValue );
355 returnValue = boolValue ? 1 : 0;
358 case GLUT_WINDOW_STEREO:
359 #if defined(_WIN32_WCE)
360 boolValue = (GLboolean)0; /* WinCE doesn't support this feature */
362 glGetBooleanv ( GL_STEREO, &boolValue );
363 returnValue = boolValue ? 1 : 0;
367 case GLUT_WINDOW_RED_SIZE:
368 glGetIntegerv ( GL_RED_BITS, &returnValue );
370 case GLUT_WINDOW_GREEN_SIZE:
371 glGetIntegerv ( GL_GREEN_BITS, &returnValue );
373 case GLUT_WINDOW_BLUE_SIZE:
374 glGetIntegerv ( GL_BLUE_BITS, &returnValue );
376 case GLUT_WINDOW_ALPHA_SIZE:
377 glGetIntegerv ( GL_ALPHA_BITS, &returnValue );
379 case GLUT_WINDOW_ACCUM_RED_SIZE:
380 #if defined(_WIN32_WCE)
381 returnValue = 0; /* WinCE doesn't support this feature */
383 glGetIntegerv ( GL_ACCUM_RED_BITS, &returnValue );
386 case GLUT_WINDOW_ACCUM_GREEN_SIZE:
387 #if defined(_WIN32_WCE)
388 returnValue = 0; /* WinCE doesn't support this feature */
390 glGetIntegerv ( GL_ACCUM_GREEN_BITS, &returnValue );
393 case GLUT_WINDOW_ACCUM_BLUE_SIZE:
394 #if defined(_WIN32_WCE)
395 returnValue = 0; /* WinCE doesn't support this feature */
397 glGetIntegerv ( GL_ACCUM_BLUE_BITS, &returnValue );
400 case GLUT_WINDOW_ACCUM_ALPHA_SIZE:
401 #if defined(_WIN32_WCE)
402 returnValue = 0; /* WinCE doesn't support this feature */
404 glGetIntegerv ( GL_ACCUM_ALPHA_BITS, &returnValue );
407 case GLUT_WINDOW_DEPTH_SIZE:
408 glGetIntegerv ( GL_DEPTH_BITS, &returnValue );
411 case GLUT_WINDOW_BUFFER_SIZE:
412 returnValue = 1 ; /* ????? */
414 case GLUT_WINDOW_STENCIL_SIZE:
415 returnValue = 0 ; /* ????? */
420 case GLUT_WINDOW_WIDTH:
421 case GLUT_WINDOW_HEIGHT:
424 * There is considerable confusion about the "right thing to
425 * do" concerning window size and position. GLUT itself is
426 * not consistent between Windows and UNIX/X11; since
427 * platform independence is a virtue for "freeglut", we
428 * decided to break with GLUT's behaviour.
430 * Under UNIX/X11, it is apparently not possible to get the
431 * window border sizes in order to subtract them off the
432 * window's initial position until some time after the window
433 * has been created. Therefore we decided on the following
434 * behaviour, both under Windows and under UNIX/X11:
435 * - When you create a window with position (x,y) and size
436 * (w,h), the upper left hand corner of the outside of the
437 * window is at (x,y) and the size of the drawable area is
439 * - When you query the size and position of the window--as
440 * is happening here for Windows--"freeglut" will return
441 * the size of the drawable area--the (w,h) that you
442 * specified when you created the window--and the coordinates
443 * of the upper left hand corner of the drawable
444 * area--which is NOT the (x,y) you specified.
449 freeglut_return_val_if_fail( fgStructure.CurrentWindow != NULL, 0 );
451 #if defined(_WIN32_WCE)
452 GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect );
454 winRect = fghGetClientArea(fgStructure.CurrentWindow, FALSE);
455 #endif /* defined(_WIN32_WCE) */
459 case GLUT_WINDOW_X: return winRect.left ;
460 case GLUT_WINDOW_Y: return winRect.top ;
461 case GLUT_WINDOW_WIDTH: return winRect.right - winRect.left;
462 case GLUT_WINDOW_HEIGHT: return winRect.bottom - winRect.top;
467 case GLUT_WINDOW_BORDER_WIDTH :
468 case GLUT_WINDOW_HEADER_HEIGHT :
469 #if defined(_WIN32_WCE)
475 if (fgStructure.CurrentWindow && fgStructure.CurrentWindow->Window.Handle)
476 windowStyle = GetWindowLong(fgStructure.CurrentWindow->Window.Handle, GWL_STYLE);
478 /* If no window, return sizes for a default window with title bar and border */
479 windowStyle = WS_OVERLAPPEDWINDOW;
483 case GLUT_WINDOW_BORDER_WIDTH:
485 int xBorderWidth, yBorderWidth;
486 fghGetBorderWidth(windowStyle, &xBorderWidth, &yBorderWidth);
489 case GLUT_WINDOW_HEADER_HEIGHT:
490 /* Need to query for WS_MAXIMIZEBOX to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */
491 return (windowStyle & WS_MAXIMIZEBOX)? GetSystemMetrics( SM_CYCAPTION ) : 0;
494 #endif /* defined(_WIN32_WCE) */
496 case GLUT_DISPLAY_MODE_POSSIBLE:
497 #if defined(_WIN32_WCE)
500 return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
502 #endif /* defined(_WIN32_WCE) */
505 case GLUT_WINDOW_FORMAT_ID:
506 #if !defined(_WIN32_WCE)
507 if( fgStructure.CurrentWindow != NULL )
508 return GetPixelFormat( fgStructure.CurrentWindow->Window.Device );
509 #endif /* defined(_WIN32_WCE) */
514 /* The window structure queries */
515 case GLUT_WINDOW_PARENT:
516 if( fgStructure.CurrentWindow == NULL ) return 0;
517 if( fgStructure.CurrentWindow->Parent == NULL ) return 0;
518 return fgStructure.CurrentWindow->Parent->ID;
520 case GLUT_WINDOW_NUM_CHILDREN:
521 if( fgStructure.CurrentWindow == NULL )
523 return fgListLength( &fgStructure.CurrentWindow->Children );
525 case GLUT_WINDOW_CURSOR:
526 if( fgStructure.CurrentWindow == NULL )
528 return fgStructure.CurrentWindow->State.Cursor;
530 case GLUT_MENU_NUM_ITEMS:
531 if( fgStructure.CurrentMenu == NULL )
533 return fgListLength( &fgStructure.CurrentMenu->Entries );
535 case GLUT_ACTION_ON_WINDOW_CLOSE:
536 return fgState.ActionOnWindowClose;
539 return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH;
541 case GLUT_RENDERING_CONTEXT:
542 return fgState.UseCurrentContext ? GLUT_USE_CURRENT_CONTEXT
543 : GLUT_CREATE_NEW_CONTEXT;
545 case GLUT_DIRECT_RENDERING:
546 return fgState.DirectContext;
548 case GLUT_FULL_SCREEN:
549 return fgStructure.CurrentWindow->State.IsFullscreen;
552 return fgState.AuxiliaryBufferNumber;
554 case GLUT_MULTISAMPLE:
555 return fgState.SampleNumber;
558 fgWarning( "glutGet(): missing enum handle %d", eWhat );
565 * Returns various device information.
567 int FGAPIENTRY glutDeviceGet( GLenum eWhat )
569 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDeviceGet" );
571 /* XXX WARNING: we are mostly lying in this function. */
574 case GLUT_HAS_KEYBOARD:
576 * Win32 is assumed a keyboard, and this cannot be queried,
577 * except for WindowsCE.
579 * X11 has a core keyboard by definition, although it can
580 * be present as a virtual/dummy keyboard. For now, there
581 * is no reliable way to tell if a real keyboard is present.
583 #if defined(_WIN32_CE)
584 return ( GetKeyboardStatus() & KBDI_KEYBOARD_PRESENT ) ? 1 : 0;
585 # if FREEGLUT_LIB_PRAGMAS
586 # pragma comment (lib,"Kbdui.lib")
593 #if TARGET_HOST_POSIX_X11
595 /* X11 has a mouse by definition */
599 case GLUT_NUM_MOUSE_BUTTONS:
600 /* We should be able to pass NULL when the last argument is zero,
601 * but at least one X server has a bug where this causes a segfault.
603 * In XFree86/Xorg servers, a mouse wheel is seen as two buttons
604 * rather than an Axis; "freeglut_main.c" expects this when
605 * checking for a wheel event.
609 int nbuttons = XGetPointerMapping(fgDisplay.Display, &map,0);
613 #elif TARGET_HOST_MS_WINDOWS
617 * MS Windows can be booted without a mouse.
619 return GetSystemMetrics( SM_MOUSEPRESENT );
621 case GLUT_NUM_MOUSE_BUTTONS:
622 # if defined(_WIN32_WCE)
625 return GetSystemMetrics( SM_CMOUSEBUTTONS );
629 case GLUT_HAS_JOYSTICK:
630 return fgJoystickDetect ();
632 case GLUT_OWNS_JOYSTICK:
633 return fgState.JoysticksInitialised;
635 case GLUT_JOYSTICK_POLL_RATE:
636 return fgStructure.CurrentWindow ? fgStructure.CurrentWindow->State.JoystickPollRate : 0;
638 /* XXX The following two are only for Joystick 0 but this is an improvement */
639 case GLUT_JOYSTICK_BUTTONS:
640 return glutJoystickGetNumButtons ( 0 );
642 case GLUT_JOYSTICK_AXES:
643 return glutJoystickGetNumAxes ( 0 );
645 case GLUT_HAS_DIAL_AND_BUTTON_BOX:
646 return fgInputDeviceDetect ();
649 if ( fgState.InputDevsInitialised ) return 8;
652 case GLUT_NUM_BUTTON_BOX_BUTTONS:
655 case GLUT_HAS_SPACEBALL:
656 return fgHasSpaceball();
658 case GLUT_HAS_TABLET:
661 case GLUT_NUM_SPACEBALL_BUTTONS:
662 return fgSpaceballNumButtons();
664 case GLUT_NUM_TABLET_BUTTONS:
667 case GLUT_DEVICE_IGNORE_KEY_REPEAT:
668 return fgStructure.CurrentWindow ? fgStructure.CurrentWindow->State.IgnoreKeyRepeat : 0;
670 case GLUT_DEVICE_KEY_REPEAT:
671 return fgState.KeyRepeat;
674 fgWarning( "glutDeviceGet(): missing enum handle %d", eWhat );
678 /* And now -- the failure. */
683 * This should return the current state of ALT, SHIFT and CTRL keys.
685 int FGAPIENTRY glutGetModifiers( void )
687 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetModifiers" );
688 if( fgState.Modifiers == INVALID_MODIFIERS )
690 fgWarning( "glutGetModifiers() called outside an input callback" );
694 return fgState.Modifiers;
698 * Return the state of the GLUT API overlay subsystem. A misery ;-)
700 int FGAPIENTRY glutLayerGet( GLenum eWhat )
702 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutLayerGet" );
705 * This is easy as layers are not implemented ;-)
707 * XXX Can we merge the UNIX/X11 and WIN32 sections? Or
708 * XXX is overlay support planned?
713 #if TARGET_HOST_POSIX_X11
715 case GLUT_OVERLAY_POSSIBLE:
718 case GLUT_LAYER_IN_USE:
721 case GLUT_HAS_OVERLAY:
724 case GLUT_TRANSPARENT_INDEX:
726 * Return just anything, which is always defined as zero
732 case GLUT_NORMAL_DAMAGED:
733 /* XXX Actually I do not know. Maybe. */
736 case GLUT_OVERLAY_DAMAGED:
739 #elif TARGET_HOST_MS_WINDOWS
741 case GLUT_OVERLAY_POSSIBLE:
742 /* return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE,
743 PFD_OVERLAY_PLANE ); */
746 case GLUT_LAYER_IN_USE:
749 case GLUT_HAS_OVERLAY:
752 case GLUT_TRANSPARENT_INDEX:
754 * Return just anything, which is always defined as zero
760 case GLUT_NORMAL_DAMAGED:
761 /* XXX Actually I do not know. Maybe. */
764 case GLUT_OVERLAY_DAMAGED:
769 fgWarning( "glutLayerGet(): missing enum handle %d", eWhat );
773 /* And fail. That's good. Programs do love failing. */
777 int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size)
781 #if TARGET_HOST_POSIX_X11
783 GLXFBConfig * fbconfigArray; /* Array of FBConfigs */
784 int fbconfigArraySize; /* Number of FBConfigs in the array */
785 int attribute_name = 0;
788 FREEGLUT_EXIT_IF_NOT_INITIALISED("glutGetModeValues");
795 #if TARGET_HOST_POSIX_X11
797 case GLUT_MULTISAMPLE:
799 attributes[0] = GLX_BUFFER_SIZE;
800 attributes[1] = GLX_DONT_CARE;
806 FBConfigs are now sorted by increasing number of auxiliary
807 buffers. We want at least one buffer.
809 attributes[2] = GLX_AUX_BUFFERS;
811 attributes[4] = None;
813 attribute_name = GLX_AUX_BUFFERS;
818 case GLUT_MULTISAMPLE:
819 attributes[2] = GLX_AUX_BUFFERS;
820 attributes[3] = GLX_DONT_CARE;
821 attributes[4] = GLX_SAMPLE_BUFFERS;
824 FBConfigs are now sorted by increasing number of samples per
825 pixel. We want at least one sample.
827 attributes[6] = GLX_SAMPLES;
829 attributes[8] = None;
831 attribute_name = GLX_SAMPLES;
836 fbconfigArray = glXChooseFBConfig(fgDisplay.Display,
841 if (fbconfigArray != NULL)
844 int result; /* Returned by glXGetFBConfigAttrib. Not checked. */
848 temp_array = malloc(sizeof(int) * fbconfigArraySize);
851 for (i = 0; i < fbconfigArraySize; i++)
855 result = glXGetFBConfigAttrib(fgDisplay.Display,
859 if (value > previous_value)
861 temp_array[*size] = value;
862 previous_value = value;
867 array = malloc(sizeof(int) * (*size));
868 for (i = 0; i < *size; i++)
870 array[i] = temp_array[i];
874 XFree(fbconfigArray);
887 /*** END OF FILE ***/