4 * Functions related to OpenGL extensions.
\r
6 * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
\r
7 * Written by Pawel W. Olszta, <olszta@sourceforge.net>
\r
8 * Creation date: Thu Dec 9 1999
\r
10 * Permission is hereby granted, free of charge, to any person obtaining a
\r
11 * copy of this software and associated documentation files (the "Software"),
\r
12 * to deal in the Software without restriction, including without limitation
\r
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
\r
14 * and/or sell copies of the Software, and to permit persons to whom the
\r
15 * Software is furnished to do so, subject to the following conditions:
\r
17 * The above copyright notice and this permission notice shall be included
\r
18 * in all copies or substantial portions of the Software.
\r
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
\r
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
\r
23 * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
24 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
28 #define GLX_GLXEXT_PROTOTYPES
\r
29 #include <GL/freeglut.h>
\r
30 #include "freeglut_internal.h"
\r
32 extern SFG_Proc fghGetProcAddress( const char *procName );
\r
33 extern GLUTproc fgPlatformGlutGetProcAddress( const char *procName );
\r
35 static GLUTproc fghGetGLUTProcAddress( const char* procName )
\r
37 /* optimization: quick initial check */
\r
38 if( strncmp( procName, "glut", 4 ) != 0 )
\r
41 #define CHECK_NAME(x) if( strcmp( procName, #x ) == 0) return (GLUTproc)x;
\r
42 CHECK_NAME(glutInit);
\r
43 CHECK_NAME(glutInitDisplayMode);
\r
44 CHECK_NAME(glutInitDisplayString);
\r
45 CHECK_NAME(glutInitWindowPosition);
\r
46 CHECK_NAME(glutInitWindowSize);
\r
47 CHECK_NAME(glutMainLoop);
\r
48 CHECK_NAME(glutExit);
\r
49 CHECK_NAME(glutCreateWindow);
\r
50 CHECK_NAME(glutCreateSubWindow);
\r
51 CHECK_NAME(glutDestroyWindow);
\r
52 CHECK_NAME(glutPostRedisplay);
\r
53 CHECK_NAME(glutPostWindowRedisplay);
\r
54 CHECK_NAME(glutSwapBuffers);
\r
55 CHECK_NAME(glutGetWindow);
\r
56 CHECK_NAME(glutSetWindow);
\r
57 CHECK_NAME(glutSetWindowTitle);
\r
58 CHECK_NAME(glutSetIconTitle);
\r
59 CHECK_NAME(glutPositionWindow);
\r
60 CHECK_NAME(glutReshapeWindow);
\r
61 CHECK_NAME(glutPopWindow);
\r
62 CHECK_NAME(glutPushWindow);
\r
63 CHECK_NAME(glutIconifyWindow);
\r
64 CHECK_NAME(glutShowWindow);
\r
65 CHECK_NAME(glutHideWindow);
\r
66 CHECK_NAME(glutFullScreen);
\r
67 CHECK_NAME(glutSetCursor);
\r
68 CHECK_NAME(glutWarpPointer);
\r
69 CHECK_NAME(glutEstablishOverlay);
\r
70 CHECK_NAME(glutRemoveOverlay);
\r
71 CHECK_NAME(glutUseLayer);
\r
72 CHECK_NAME(glutPostOverlayRedisplay);
\r
73 CHECK_NAME(glutPostWindowOverlayRedisplay);
\r
74 CHECK_NAME(glutShowOverlay);
\r
75 CHECK_NAME(glutHideOverlay);
\r
76 CHECK_NAME(glutCreateMenu);
\r
77 CHECK_NAME(glutDestroyMenu);
\r
78 CHECK_NAME(glutGetMenu);
\r
79 CHECK_NAME(glutSetMenu);
\r
80 CHECK_NAME(glutAddMenuEntry);
\r
81 CHECK_NAME(glutAddSubMenu);
\r
82 CHECK_NAME(glutChangeToMenuEntry);
\r
83 CHECK_NAME(glutChangeToSubMenu);
\r
84 CHECK_NAME(glutRemoveMenuItem);
\r
85 CHECK_NAME(glutAttachMenu);
\r
86 CHECK_NAME(glutDetachMenu);
\r
87 CHECK_NAME(glutDisplayFunc);
\r
88 CHECK_NAME(glutReshapeFunc);
\r
89 CHECK_NAME(glutKeyboardFunc);
\r
90 CHECK_NAME(glutMouseFunc);
\r
91 CHECK_NAME(glutMultiEntryFunc);
\r
92 CHECK_NAME(glutMultiMotionFunc);
\r
93 CHECK_NAME(glutMultiButtonFunc);
\r
94 CHECK_NAME(glutMultiPassiveFunc);
\r
95 CHECK_NAME(glutMotionFunc);
\r
96 CHECK_NAME(glutPassiveMotionFunc);
\r
97 CHECK_NAME(glutEntryFunc);
\r
98 CHECK_NAME(glutVisibilityFunc);
\r
99 CHECK_NAME(glutIdleFunc);
\r
100 CHECK_NAME(glutTimerFunc);
\r
101 CHECK_NAME(glutMenuStateFunc);
\r
102 CHECK_NAME(glutSpecialFunc);
\r
103 CHECK_NAME(glutSpaceballMotionFunc);
\r
104 CHECK_NAME(glutSpaceballRotateFunc);
\r
105 CHECK_NAME(glutSpaceballButtonFunc);
\r
106 CHECK_NAME(glutButtonBoxFunc);
\r
107 CHECK_NAME(glutDialsFunc);
\r
108 CHECK_NAME(glutTabletMotionFunc);
\r
109 CHECK_NAME(glutTabletButtonFunc);
\r
110 CHECK_NAME(glutMenuStatusFunc);
\r
111 CHECK_NAME(glutOverlayDisplayFunc);
\r
112 CHECK_NAME(glutWindowStatusFunc);
\r
113 CHECK_NAME(glutKeyboardUpFunc);
\r
114 CHECK_NAME(glutSpecialUpFunc);
\r
115 CHECK_NAME(glutSetColor);
\r
116 CHECK_NAME(glutGetColor);
\r
117 CHECK_NAME(glutCopyColormap);
\r
118 CHECK_NAME(glutGet);
\r
119 CHECK_NAME(glutDeviceGet);
\r
120 CHECK_NAME(glutExtensionSupported);
\r
121 CHECK_NAME(glutGetModifiers);
\r
122 CHECK_NAME(glutLayerGet);
\r
123 CHECK_NAME(glutBitmapCharacter);
\r
124 CHECK_NAME(glutBitmapWidth);
\r
125 CHECK_NAME(glutStrokeCharacter);
\r
126 CHECK_NAME(glutStrokeWidth);
\r
127 CHECK_NAME(glutBitmapLength);
\r
128 CHECK_NAME(glutStrokeLength);
\r
129 CHECK_NAME(glutWireSphere);
\r
130 CHECK_NAME(glutSolidSphere);
\r
131 CHECK_NAME(glutWireCone);
\r
132 CHECK_NAME(glutSolidCone);
\r
133 CHECK_NAME(glutWireCube);
\r
134 CHECK_NAME(glutSolidCube);
\r
135 CHECK_NAME(glutWireTorus);
\r
136 CHECK_NAME(glutSolidTorus);
\r
137 CHECK_NAME(glutWireDodecahedron);
\r
138 CHECK_NAME(glutSolidDodecahedron);
\r
139 CHECK_NAME(glutWireTeapot);
\r
140 CHECK_NAME(glutSolidTeapot);
\r
141 CHECK_NAME(glutWireOctahedron);
\r
142 CHECK_NAME(glutSolidOctahedron);
\r
143 CHECK_NAME(glutWireTetrahedron);
\r
144 CHECK_NAME(glutSolidTetrahedron);
\r
145 CHECK_NAME(glutWireIcosahedron);
\r
146 CHECK_NAME(glutSolidIcosahedron);
\r
147 CHECK_NAME(glutVideoResizeGet);
\r
148 CHECK_NAME(glutSetupVideoResizing);
\r
149 CHECK_NAME(glutStopVideoResizing);
\r
150 CHECK_NAME(glutVideoResize);
\r
151 CHECK_NAME(glutVideoPan);
\r
152 CHECK_NAME(glutReportErrors);
\r
153 CHECK_NAME(glutIgnoreKeyRepeat);
\r
154 CHECK_NAME(glutSetKeyRepeat);
\r
156 /* freeglut extensions */
\r
157 CHECK_NAME(glutMainLoopEvent);
\r
158 CHECK_NAME(glutLeaveMainLoop);
\r
159 CHECK_NAME(glutCloseFunc);
\r
160 CHECK_NAME(glutWMCloseFunc);
\r
161 CHECK_NAME(glutMenuDestroyFunc);
\r
162 CHECK_NAME(glutFullScreenToggle);
\r
163 CHECK_NAME(glutLeaveFullScreen);
\r
164 CHECK_NAME(glutSetOption);
\r
165 CHECK_NAME(glutGetModeValues);
\r
166 CHECK_NAME(glutSetWindowData);
\r
167 CHECK_NAME(glutGetWindowData);
\r
168 CHECK_NAME(glutSetMenuData);
\r
169 CHECK_NAME(glutGetMenuData);
\r
170 CHECK_NAME(glutBitmapHeight);
\r
171 CHECK_NAME(glutStrokeHeight);
\r
172 CHECK_NAME(glutBitmapString);
\r
173 CHECK_NAME(glutStrokeString);
\r
174 CHECK_NAME(glutWireRhombicDodecahedron);
\r
175 CHECK_NAME(glutSolidRhombicDodecahedron);
\r
176 CHECK_NAME(glutWireSierpinskiSponge);
\r
177 CHECK_NAME(glutSolidSierpinskiSponge);
\r
178 CHECK_NAME(glutWireCylinder);
\r
179 CHECK_NAME(glutSolidCylinder);
\r
180 CHECK_NAME(glutGetProcAddress);
\r
181 CHECK_NAME(glutMouseWheelFunc);
\r
182 CHECK_NAME(glutJoystickGetNumAxes);
\r
183 CHECK_NAME(glutJoystickGetNumButtons);
\r
184 CHECK_NAME(glutJoystickNotWorking);
\r
185 CHECK_NAME(glutJoystickGetDeadBand);
\r
186 CHECK_NAME(glutJoystickSetDeadBand);
\r
187 CHECK_NAME(glutJoystickGetSaturation);
\r
188 CHECK_NAME(glutJoystickSetSaturation);
\r
189 CHECK_NAME(glutJoystickSetMinRange);
\r
190 CHECK_NAME(glutJoystickSetMaxRange);
\r
191 CHECK_NAME(glutJoystickSetCenter);
\r
192 CHECK_NAME(glutJoystickGetMinRange);
\r
193 CHECK_NAME(glutJoystickGetMaxRange);
\r
194 CHECK_NAME(glutJoystickGetCenter);
\r
195 CHECK_NAME(glutInitContextVersion);
\r
196 CHECK_NAME(glutInitContextFlags);
\r
197 CHECK_NAME(glutInitContextProfile);
\r
198 CHECK_NAME(glutInitErrorFunc);
\r
199 CHECK_NAME(glutInitWarningFunc);
\r
206 #if TARGET_HOST_POSIX_X11
\r
207 static GLUTproc fghGetGLUTProcAddress( const char* procName )
\r
209 /* optimization: quick initial check */
\r
210 if( strncmp( procName, "glut", 4 ) != 0 )
\r
213 #define CHECK_NAME(x) if( strcmp( procName, #x ) == 0) return (GLUTproc)x;
\r
214 CHECK_NAME(glutJoystickFunc);
\r
215 CHECK_NAME(glutForceJoystickFunc);
\r
216 CHECK_NAME(glutGameModeString);
\r
217 CHECK_NAME(glutEnterGameMode);
\r
218 CHECK_NAME(glutLeaveGameMode);
\r
219 CHECK_NAME(glutGameModeGet);
\r
226 GLUTproc fgPlatformGlutGetProcAddress( const char* procName )
\r
232 SFG_Proc fghGetProcAddress( const char *procName )
\r
234 #if defined( GLX_ARB_get_proc_address )
\r
235 return (SFG_Proc)glXGetProcAddressARB( ( const GLubyte * )procName );
\r
243 GLUTproc FGAPIENTRY
\r
244 glutGetProcAddress( const char *procName )
\r
247 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetProcAddress" );
\r
249 /* Try GLUT functions first, then core GL functions */
\r
250 p = fghGetGLUTProcAddress( procName );
\r
252 /* Some GLUT functions are platform-specific: */
\r
254 p = fgPlatformGlutGetProcAddress( procName );
\r
256 return ( p != NULL ) ? p : fghGetProcAddress( procName );
\r