4 * Functions related to OpenGL extensions.
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 9 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 #define GLX_GLXEXT_PROTOTYPES
29 #include <GL/freeglut.h>
30 #include "fg_internal.h"
32 extern SFG_Proc fgPlatformGetProcAddress( const char *procName );
33 extern GLUTproc fgPlatformGetGLUTProcAddress( const char *procName );
35 static GLUTproc fghGetGLUTProcAddress( const char* procName )
37 /* optimization: quick initial check */
38 if( strncmp( procName, "glut", 4 ) != 0 )
41 #define CHECK_NAME(x) if( strcmp( procName, #x ) == 0) return (GLUTproc)x;
43 CHECK_NAME(glutInitDisplayMode);
44 CHECK_NAME(glutInitDisplayString);
45 CHECK_NAME(glutInitWindowPosition);
46 CHECK_NAME(glutInitWindowSize);
47 CHECK_NAME(glutMainLoop);
49 CHECK_NAME(glutCreateWindow);
50 CHECK_NAME(glutCreateSubWindow);
51 CHECK_NAME(glutDestroyWindow);
52 CHECK_NAME(glutPostRedisplay);
53 CHECK_NAME(glutPostWindowRedisplay);
54 CHECK_NAME(glutSwapBuffers);
55 CHECK_NAME(glutGetWindow);
56 CHECK_NAME(glutSetWindow);
57 CHECK_NAME(glutSetWindowTitle);
58 CHECK_NAME(glutSetIconTitle);
59 CHECK_NAME(glutPositionWindow);
60 CHECK_NAME(glutReshapeWindow);
61 CHECK_NAME(glutPopWindow);
62 CHECK_NAME(glutPushWindow);
63 CHECK_NAME(glutIconifyWindow);
64 CHECK_NAME(glutShowWindow);
65 CHECK_NAME(glutHideWindow);
66 CHECK_NAME(glutFullScreen);
67 CHECK_NAME(glutSetCursor);
68 CHECK_NAME(glutWarpPointer);
69 CHECK_NAME(glutEstablishOverlay);
70 CHECK_NAME(glutRemoveOverlay);
71 CHECK_NAME(glutUseLayer);
72 CHECK_NAME(glutPostOverlayRedisplay);
73 CHECK_NAME(glutPostWindowOverlayRedisplay);
74 CHECK_NAME(glutShowOverlay);
75 CHECK_NAME(glutHideOverlay);
76 CHECK_NAME(glutCreateMenu);
77 CHECK_NAME(glutDestroyMenu);
78 CHECK_NAME(glutGetMenu);
79 CHECK_NAME(glutSetMenu);
80 CHECK_NAME(glutAddMenuEntry);
81 CHECK_NAME(glutAddSubMenu);
82 CHECK_NAME(glutChangeToMenuEntry);
83 CHECK_NAME(glutChangeToSubMenu);
84 CHECK_NAME(glutRemoveMenuItem);
85 CHECK_NAME(glutAttachMenu);
86 CHECK_NAME(glutDetachMenu);
87 CHECK_NAME(glutDisplayFunc);
88 CHECK_NAME(glutReshapeFunc);
89 CHECK_NAME(glutPositionFunc);
90 CHECK_NAME(glutKeyboardFunc);
91 CHECK_NAME(glutMouseFunc);
92 CHECK_NAME(glutMultiEntryFunc);
93 CHECK_NAME(glutMultiMotionFunc);
94 CHECK_NAME(glutMultiButtonFunc);
95 CHECK_NAME(glutMultiPassiveFunc);
96 CHECK_NAME(glutMotionFunc);
97 CHECK_NAME(glutPassiveMotionFunc);
98 CHECK_NAME(glutEntryFunc);
99 CHECK_NAME(glutVisibilityFunc);
100 CHECK_NAME(glutIdleFunc);
101 CHECK_NAME(glutTimerFunc);
102 CHECK_NAME(glutMenuStateFunc);
103 CHECK_NAME(glutSpecialFunc);
104 CHECK_NAME(glutSpaceballMotionFunc);
105 CHECK_NAME(glutSpaceballRotateFunc);
106 CHECK_NAME(glutSpaceballButtonFunc);
107 CHECK_NAME(glutButtonBoxFunc);
108 CHECK_NAME(glutDialsFunc);
109 CHECK_NAME(glutTabletMotionFunc);
110 CHECK_NAME(glutTabletButtonFunc);
111 CHECK_NAME(glutMenuStatusFunc);
112 CHECK_NAME(glutOverlayDisplayFunc);
113 CHECK_NAME(glutWindowStatusFunc);
114 CHECK_NAME(glutKeyboardUpFunc);
115 CHECK_NAME(glutSpecialUpFunc);
116 CHECK_NAME(glutSetColor);
117 CHECK_NAME(glutGetColor);
118 CHECK_NAME(glutCopyColormap);
120 CHECK_NAME(glutDeviceGet);
121 CHECK_NAME(glutExtensionSupported);
122 CHECK_NAME(glutGetModifiers);
123 CHECK_NAME(glutLayerGet);
124 CHECK_NAME(glutBitmapCharacter);
125 CHECK_NAME(glutBitmapWidth);
126 CHECK_NAME(glutStrokeCharacter);
127 CHECK_NAME(glutStrokeWidth);
128 CHECK_NAME(glutStrokeWidthf);
129 CHECK_NAME(glutBitmapLength);
130 CHECK_NAME(glutStrokeLength);
131 CHECK_NAME(glutStrokeLengthf);
132 CHECK_NAME(glutWireSphere);
133 CHECK_NAME(glutSolidSphere);
134 CHECK_NAME(glutWireCone);
135 CHECK_NAME(glutSolidCone);
136 CHECK_NAME(glutWireTorus);
137 CHECK_NAME(glutSolidTorus);
138 CHECK_NAME(glutWireCylinder);
139 CHECK_NAME(glutSolidCylinder);
140 CHECK_NAME(glutWireTeapot);
141 CHECK_NAME(glutSolidTeapot);
142 CHECK_NAME(glutWireTeacup);
143 CHECK_NAME(glutSolidTeacup);
144 CHECK_NAME(glutWireTeaspoon);
145 CHECK_NAME(glutSolidTeaspoon);
146 CHECK_NAME(glutWireCube);
147 CHECK_NAME(glutSolidCube);
148 CHECK_NAME(glutWireDodecahedron);
149 CHECK_NAME(glutSolidDodecahedron);
150 CHECK_NAME(glutWireOctahedron);
151 CHECK_NAME(glutSolidOctahedron);
152 CHECK_NAME(glutWireTetrahedron);
153 CHECK_NAME(glutSolidTetrahedron);
154 CHECK_NAME(glutWireIcosahedron);
155 CHECK_NAME(glutSolidIcosahedron);
156 CHECK_NAME(glutWireRhombicDodecahedron);
157 CHECK_NAME(glutSolidRhombicDodecahedron);
158 CHECK_NAME(glutWireSierpinskiSponge);
159 CHECK_NAME(glutSolidSierpinskiSponge);
160 CHECK_NAME(glutVideoResizeGet);
161 CHECK_NAME(glutSetupVideoResizing);
162 CHECK_NAME(glutStopVideoResizing);
163 CHECK_NAME(glutVideoResize);
164 CHECK_NAME(glutVideoPan);
165 CHECK_NAME(glutReportErrors);
166 CHECK_NAME(glutIgnoreKeyRepeat);
167 CHECK_NAME(glutSetKeyRepeat);
169 /* freeglut extensions */
170 CHECK_NAME(glutMainLoopEvent);
171 CHECK_NAME(glutLeaveMainLoop);
172 CHECK_NAME(glutCloseFunc);
173 CHECK_NAME(glutWMCloseFunc);
174 CHECK_NAME(glutMenuDestroyFunc);
175 CHECK_NAME(glutFullScreenToggle);
176 CHECK_NAME(glutLeaveFullScreen);
177 CHECK_NAME(glutSetMenuFont);
178 CHECK_NAME(glutSetOption);
179 CHECK_NAME(glutGetModeValues);
180 CHECK_NAME(glutSetWindowData);
181 CHECK_NAME(glutGetWindowData);
182 CHECK_NAME(glutSetMenuData);
183 CHECK_NAME(glutGetMenuData);
184 CHECK_NAME(glutBitmapHeight);
185 CHECK_NAME(glutStrokeHeight);
186 CHECK_NAME(glutBitmapString);
187 CHECK_NAME(glutStrokeString);
188 CHECK_NAME(glutGetProcAddress);
189 CHECK_NAME(glutMouseWheelFunc);
190 CHECK_NAME(glutJoystickGetNumAxes);
191 CHECK_NAME(glutJoystickGetNumButtons);
192 CHECK_NAME(glutJoystickNotWorking);
193 CHECK_NAME(glutJoystickGetDeadBand);
194 CHECK_NAME(glutJoystickSetDeadBand);
195 CHECK_NAME(glutJoystickGetSaturation);
196 CHECK_NAME(glutJoystickSetSaturation);
197 CHECK_NAME(glutJoystickSetMinRange);
198 CHECK_NAME(glutJoystickSetMaxRange);
199 CHECK_NAME(glutJoystickSetCenter);
200 CHECK_NAME(glutJoystickGetMinRange);
201 CHECK_NAME(glutJoystickGetMaxRange);
202 CHECK_NAME(glutJoystickGetCenter);
203 CHECK_NAME(glutInitContextVersion);
204 CHECK_NAME(glutInitContextFlags);
205 CHECK_NAME(glutInitContextProfile);
206 CHECK_NAME(glutInitErrorFunc);
207 CHECK_NAME(glutInitWarningFunc);
208 CHECK_NAME(glutInitContextFunc);
209 CHECK_NAME(glutAppStatusFunc);
210 CHECK_NAME(glutSetVertexAttribCoord3);
211 CHECK_NAME(glutSetVertexAttribNormal);
212 CHECK_NAME(glutSetVertexAttribTexCoord2);
214 /* freeglut user callback functions */
215 CHECK_NAME(glutCreateMenuUcall);
216 CHECK_NAME(glutTimerFuncUcall);
217 CHECK_NAME(glutIdleFuncUcall);
218 CHECK_NAME(glutKeyboardFuncUcall);
219 CHECK_NAME(glutSpecialFuncUcall);
220 CHECK_NAME(glutReshapeFuncUcall);
221 CHECK_NAME(glutVisibilityFuncUcall);
222 CHECK_NAME(glutDisplayFuncUcall);
223 CHECK_NAME(glutMouseFuncUcall);
224 CHECK_NAME(glutMotionFuncUcall);
225 CHECK_NAME(glutPassiveMotionFuncUcall);
226 CHECK_NAME(glutEntryFuncUcall);
227 CHECK_NAME(glutKeyboardUpFuncUcall);
228 CHECK_NAME(glutSpecialUpFuncUcall);
229 CHECK_NAME(glutJoystickFuncUcall);
230 CHECK_NAME(glutMenuStatusFuncUcall);
231 CHECK_NAME(glutOverlayDisplayFuncUcall);
232 CHECK_NAME(glutWindowStatusFuncUcall);
233 CHECK_NAME(glutSpaceballMotionFuncUcall);
234 CHECK_NAME(glutSpaceballRotateFuncUcall);
235 CHECK_NAME(glutSpaceballButtonFuncUcall);
236 CHECK_NAME(glutButtonBoxFuncUcall);
237 CHECK_NAME(glutDialsFuncUcall);
238 CHECK_NAME(glutTabletMotionFuncUcall);
239 CHECK_NAME(glutTabletButtonFuncUcall);
240 CHECK_NAME(glutMouseWheelFuncUcall);
241 CHECK_NAME(glutPositionFuncUcall);
242 CHECK_NAME(glutCloseFuncUcall);
243 CHECK_NAME(glutWMCloseFuncUcall);
244 CHECK_NAME(glutMenuDestroyFuncUcall);
245 CHECK_NAME(glutMultiEntryFuncUcall);
246 CHECK_NAME(glutMultiButtonFuncUcall);
247 CHECK_NAME(glutMultiMotionFuncUcall);
248 CHECK_NAME(glutMultiPassiveFuncUcall);
249 CHECK_NAME(glutInitErrorFuncUcall);
250 CHECK_NAME(glutInitWarningFuncUcall);
251 CHECK_NAME(glutInitContextFuncUcall);
252 CHECK_NAME(glutAppStatusFuncUcall);
261 glutGetProcAddress( const char *procName )
264 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetProcAddress" );
266 /* Try GLUT functions first, then core GL functions */
267 p = fghGetGLUTProcAddress( procName );
269 /* Some GLUT functions are platform-specific: */
271 p = fgPlatformGetGLUTProcAddress( procName );
273 return ( p != NULL ) ? p : fgPlatformGetProcAddress( procName );