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(glutKeyboardFunc);
90 CHECK_NAME(glutMouseFunc);
91 CHECK_NAME(glutMultiEntryFunc);
92 CHECK_NAME(glutMultiMotionFunc);
93 CHECK_NAME(glutMultiButtonFunc);
94 CHECK_NAME(glutMultiPassiveFunc);
95 CHECK_NAME(glutMotionFunc);
96 CHECK_NAME(glutPassiveMotionFunc);
97 CHECK_NAME(glutEntryFunc);
98 CHECK_NAME(glutVisibilityFunc);
99 CHECK_NAME(glutIdleFunc);
100 CHECK_NAME(glutTimerFunc);
101 CHECK_NAME(glutMenuStateFunc);
102 CHECK_NAME(glutSpecialFunc);
103 CHECK_NAME(glutSpaceballMotionFunc);
104 CHECK_NAME(glutSpaceballRotateFunc);
105 CHECK_NAME(glutSpaceballButtonFunc);
106 CHECK_NAME(glutButtonBoxFunc);
107 CHECK_NAME(glutDialsFunc);
108 CHECK_NAME(glutTabletMotionFunc);
109 CHECK_NAME(glutTabletButtonFunc);
110 CHECK_NAME(glutMenuStatusFunc);
111 CHECK_NAME(glutOverlayDisplayFunc);
112 CHECK_NAME(glutWindowStatusFunc);
113 CHECK_NAME(glutKeyboardUpFunc);
114 CHECK_NAME(glutSpecialUpFunc);
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);
156 /* freeglut extensions */
157 CHECK_NAME(glutMainLoopEvent);
158 CHECK_NAME(glutLeaveMainLoop);
159 CHECK_NAME(glutCloseFunc);
160 CHECK_NAME(glutWMCloseFunc);
161 CHECK_NAME(glutMenuDestroyFunc);
162 CHECK_NAME(glutFullScreenToggle);
163 CHECK_NAME(glutLeaveFullScreen);
164 CHECK_NAME(glutSetOption);
165 CHECK_NAME(glutGetModeValues);
166 CHECK_NAME(glutSetWindowData);
167 CHECK_NAME(glutGetWindowData);
168 CHECK_NAME(glutSetMenuData);
169 CHECK_NAME(glutGetMenuData);
170 CHECK_NAME(glutBitmapHeight);
171 CHECK_NAME(glutStrokeHeight);
172 CHECK_NAME(glutBitmapString);
173 CHECK_NAME(glutStrokeString);
174 CHECK_NAME(glutWireRhombicDodecahedron);
175 CHECK_NAME(glutSolidRhombicDodecahedron);
176 CHECK_NAME(glutWireSierpinskiSponge);
177 CHECK_NAME(glutSolidSierpinskiSponge);
178 CHECK_NAME(glutWireCylinder);
179 CHECK_NAME(glutSolidCylinder);
180 CHECK_NAME(glutGetProcAddress);
181 CHECK_NAME(glutMouseWheelFunc);
182 CHECK_NAME(glutJoystickGetNumAxes);
183 CHECK_NAME(glutJoystickGetNumButtons);
184 CHECK_NAME(glutJoystickNotWorking);
185 CHECK_NAME(glutJoystickGetDeadBand);
186 CHECK_NAME(glutJoystickSetDeadBand);
187 CHECK_NAME(glutJoystickGetSaturation);
188 CHECK_NAME(glutJoystickSetSaturation);
189 CHECK_NAME(glutJoystickSetMinRange);
190 CHECK_NAME(glutJoystickSetMaxRange);
191 CHECK_NAME(glutJoystickSetCenter);
192 CHECK_NAME(glutJoystickGetMinRange);
193 CHECK_NAME(glutJoystickGetMaxRange);
194 CHECK_NAME(glutJoystickGetCenter);
195 CHECK_NAME(glutInitContextVersion);
196 CHECK_NAME(glutInitContextFlags);
197 CHECK_NAME(glutInitContextProfile);
198 CHECK_NAME(glutInitErrorFunc);
199 CHECK_NAME(glutInitWarningFunc);
208 glutGetProcAddress( const char *procName )
211 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetProcAddress" );
213 /* Try GLUT functions first, then core GL functions */
214 p = fghGetGLUTProcAddress( procName );
216 /* Some GLUT functions are platform-specific: */
218 p = fgPlatformGetGLUTProcAddress( procName );
220 return ( p != NULL ) ? p : fgPlatformGetProcAddress( procName );