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 "freeglut_internal.h"
32 static GLUTproc fghGetGLUTProcAddress( const char* procName )
34 /* optimization: quick initial check */
35 if( strncmp( procName, "glut", 4 ) != 0 )
38 #define CHECK_NAME(x) if( strcmp( procName, #x ) == 0) return (GLUTproc)x;
40 CHECK_NAME(glutInitDisplayMode);
41 CHECK_NAME(glutInitDisplayString);
42 CHECK_NAME(glutInitWindowPosition);
43 CHECK_NAME(glutInitWindowSize);
44 CHECK_NAME(glutMainLoop);
46 CHECK_NAME(glutCreateWindow);
47 CHECK_NAME(glutCreateSubWindow);
48 CHECK_NAME(glutDestroyWindow);
49 CHECK_NAME(glutPostRedisplay);
50 CHECK_NAME(glutPostWindowRedisplay);
51 CHECK_NAME(glutSwapBuffers);
52 CHECK_NAME(glutGetWindow);
53 CHECK_NAME(glutSetWindow);
54 CHECK_NAME(glutSetWindowTitle);
55 CHECK_NAME(glutSetIconTitle);
56 CHECK_NAME(glutPositionWindow);
57 CHECK_NAME(glutReshapeWindow);
58 CHECK_NAME(glutPopWindow);
59 CHECK_NAME(glutPushWindow);
60 CHECK_NAME(glutIconifyWindow);
61 CHECK_NAME(glutShowWindow);
62 CHECK_NAME(glutHideWindow);
63 CHECK_NAME(glutFullScreen);
64 CHECK_NAME(glutSetCursor);
65 CHECK_NAME(glutWarpPointer);
66 CHECK_NAME(glutEstablishOverlay);
67 CHECK_NAME(glutRemoveOverlay);
68 CHECK_NAME(glutUseLayer);
69 CHECK_NAME(glutPostOverlayRedisplay);
70 CHECK_NAME(glutPostWindowOverlayRedisplay);
71 CHECK_NAME(glutShowOverlay);
72 CHECK_NAME(glutHideOverlay);
73 CHECK_NAME(glutCreateMenu);
74 CHECK_NAME(glutDestroyMenu);
75 CHECK_NAME(glutGetMenu);
76 CHECK_NAME(glutSetMenu);
77 CHECK_NAME(glutAddMenuEntry);
78 CHECK_NAME(glutAddSubMenu);
79 CHECK_NAME(glutChangeToMenuEntry);
80 CHECK_NAME(glutChangeToSubMenu);
81 CHECK_NAME(glutRemoveMenuItem);
82 CHECK_NAME(glutAttachMenu);
83 CHECK_NAME(glutDetachMenu);
84 CHECK_NAME(glutDisplayFunc);
85 CHECK_NAME(glutReshapeFunc);
86 CHECK_NAME(glutKeyboardFunc);
87 CHECK_NAME(glutMouseFunc);
88 CHECK_NAME(glutMultiEntryFunc);
89 CHECK_NAME(glutMultiMotionFunc);
90 CHECK_NAME(glutMultiButtonFunc);
91 CHECK_NAME(glutMultiPassiveFunc);
92 CHECK_NAME(glutMotionFunc);
93 CHECK_NAME(glutPassiveMotionFunc);
94 CHECK_NAME(glutEntryFunc);
95 CHECK_NAME(glutVisibilityFunc);
96 CHECK_NAME(glutIdleFunc);
97 CHECK_NAME(glutTimerFunc);
98 CHECK_NAME(glutMenuStateFunc);
99 CHECK_NAME(glutSpecialFunc);
100 CHECK_NAME(glutSpaceballMotionFunc);
101 CHECK_NAME(glutSpaceballRotateFunc);
102 CHECK_NAME(glutSpaceballButtonFunc);
103 CHECK_NAME(glutButtonBoxFunc);
104 CHECK_NAME(glutDialsFunc);
105 CHECK_NAME(glutTabletMotionFunc);
106 CHECK_NAME(glutTabletButtonFunc);
107 CHECK_NAME(glutMenuStatusFunc);
108 CHECK_NAME(glutOverlayDisplayFunc);
109 CHECK_NAME(glutWindowStatusFunc);
110 CHECK_NAME(glutKeyboardUpFunc);
111 CHECK_NAME(glutSpecialUpFunc);
112 #if !defined(_WIN32_WCE)
113 CHECK_NAME(glutJoystickFunc);
114 #endif /* !defined(_WIN32_WCE) */
115 CHECK_NAME(glutSetColor);
116 CHECK_NAME(glutGetColor);
117 CHECK_NAME(glutCopyColormap);
119 CHECK_NAME(glutDeviceGet);
120 CHECK_NAME(glutExtensionSupported);
121 CHECK_NAME(glutGetModifiers);
122 CHECK_NAME(glutLayerGet);
123 CHECK_NAME(glutBitmapCharacter);
124 CHECK_NAME(glutBitmapWidth);
125 CHECK_NAME(glutStrokeCharacter);
126 CHECK_NAME(glutStrokeWidth);
127 CHECK_NAME(glutBitmapLength);
128 CHECK_NAME(glutStrokeLength);
129 CHECK_NAME(glutWireSphere);
130 CHECK_NAME(glutSolidSphere);
131 CHECK_NAME(glutWireCone);
132 CHECK_NAME(glutSolidCone);
133 CHECK_NAME(glutWireCube);
134 CHECK_NAME(glutSolidCube);
135 CHECK_NAME(glutWireTorus);
136 CHECK_NAME(glutSolidTorus);
137 CHECK_NAME(glutWireDodecahedron);
138 CHECK_NAME(glutSolidDodecahedron);
139 CHECK_NAME(glutWireTeapot);
140 CHECK_NAME(glutSolidTeapot);
141 CHECK_NAME(glutWireOctahedron);
142 CHECK_NAME(glutSolidOctahedron);
143 CHECK_NAME(glutWireTetrahedron);
144 CHECK_NAME(glutSolidTetrahedron);
145 CHECK_NAME(glutWireIcosahedron);
146 CHECK_NAME(glutSolidIcosahedron);
147 CHECK_NAME(glutVideoResizeGet);
148 CHECK_NAME(glutSetupVideoResizing);
149 CHECK_NAME(glutStopVideoResizing);
150 CHECK_NAME(glutVideoResize);
151 CHECK_NAME(glutVideoPan);
152 CHECK_NAME(glutReportErrors);
153 CHECK_NAME(glutIgnoreKeyRepeat);
154 CHECK_NAME(glutSetKeyRepeat);
155 #if !defined(_WIN32_WCE)
156 CHECK_NAME(glutForceJoystickFunc);
157 CHECK_NAME(glutGameModeString);
158 CHECK_NAME(glutEnterGameMode);
159 CHECK_NAME(glutLeaveGameMode);
160 CHECK_NAME(glutGameModeGet);
161 #endif /* !defined(_WIN32_WCE) */
162 /* freeglut extensions */
163 CHECK_NAME(glutMainLoopEvent);
164 CHECK_NAME(glutLeaveMainLoop);
165 CHECK_NAME(glutCloseFunc);
166 CHECK_NAME(glutWMCloseFunc);
167 CHECK_NAME(glutMenuDestroyFunc);
168 CHECK_NAME(glutFullScreenToggle);
169 CHECK_NAME(glutLeaveFullScreen);
170 CHECK_NAME(glutSetOption);
171 CHECK_NAME(glutGetModeValues);
172 CHECK_NAME(glutSetWindowData);
173 CHECK_NAME(glutGetWindowData);
174 CHECK_NAME(glutSetMenuData);
175 CHECK_NAME(glutGetMenuData);
176 CHECK_NAME(glutBitmapHeight);
177 CHECK_NAME(glutStrokeHeight);
178 CHECK_NAME(glutBitmapString);
179 CHECK_NAME(glutStrokeString);
180 CHECK_NAME(glutWireRhombicDodecahedron);
181 CHECK_NAME(glutSolidRhombicDodecahedron);
182 CHECK_NAME(glutWireSierpinskiSponge);
183 CHECK_NAME(glutSolidSierpinskiSponge);
184 CHECK_NAME(glutWireCylinder);
185 CHECK_NAME(glutSolidCylinder);
186 CHECK_NAME(glutGetProcAddress);
187 CHECK_NAME(glutMouseWheelFunc);
188 CHECK_NAME(glutJoystickGetNumAxes);
189 CHECK_NAME(glutJoystickGetNumButtons);
190 CHECK_NAME(glutJoystickNotWorking);
191 CHECK_NAME(glutJoystickGetDeadBand);
192 CHECK_NAME(glutJoystickSetDeadBand);
193 CHECK_NAME(glutJoystickGetSaturation);
194 CHECK_NAME(glutJoystickSetSaturation);
195 CHECK_NAME(glutJoystickSetMinRange);
196 CHECK_NAME(glutJoystickSetMaxRange);
197 CHECK_NAME(glutJoystickSetCenter);
198 CHECK_NAME(glutJoystickGetMinRange);
199 CHECK_NAME(glutJoystickGetMaxRange);
200 CHECK_NAME(glutJoystickGetCenter);
201 CHECK_NAME(glutInitContextVersion);
202 CHECK_NAME(glutInitContextFlags);
203 CHECK_NAME(glutInitContextProfile);
204 CHECK_NAME(glutInitErrorFunc);
205 CHECK_NAME(glutInitWarningFunc);
212 SFG_Proc fghGetProcAddress( const char *procName )
214 #if TARGET_HOST_MS_WINDOWS
215 return (SFG_Proc)wglGetProcAddress( ( LPCSTR )procName );
216 #elif TARGET_HOST_POSIX_X11 && defined( GLX_ARB_get_proc_address )
217 return (SFG_Proc)glXGetProcAddressARB( ( const GLubyte * )procName );
225 glutGetProcAddress( const char *procName )
228 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetProcAddress" );
230 /* Try GLUT functions first, then core GL functions */
231 p = fghGetGLUTProcAddress( procName );
232 return ( p != NULL ) ? p : fghGetProcAddress( procName );