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(glutWireTorus);
134 CHECK_NAME(glutSolidTorus);
135 CHECK_NAME(glutWireCylinder);
136 CHECK_NAME(glutSolidCylinder);
137 #ifndef EGL_VERSION_1_0
138 CHECK_NAME(glutWireTeapot);
139 CHECK_NAME(glutSolidTeapot);
141 CHECK_NAME(glutWireCube);
142 CHECK_NAME(glutSolidCube);
143 CHECK_NAME(glutWireDodecahedron);
144 CHECK_NAME(glutSolidDodecahedron);
145 CHECK_NAME(glutWireOctahedron);
146 CHECK_NAME(glutSolidOctahedron);
147 CHECK_NAME(glutWireTetrahedron);
148 CHECK_NAME(glutSolidTetrahedron);
149 CHECK_NAME(glutWireIcosahedron);
150 CHECK_NAME(glutSolidIcosahedron);
151 CHECK_NAME(glutWireRhombicDodecahedron);
152 CHECK_NAME(glutSolidRhombicDodecahedron);
153 CHECK_NAME(glutWireSierpinskiSponge);
154 CHECK_NAME(glutSolidSierpinskiSponge);
155 CHECK_NAME(glutVideoResizeGet);
156 CHECK_NAME(glutSetupVideoResizing);
157 CHECK_NAME(glutStopVideoResizing);
158 CHECK_NAME(glutVideoResize);
159 CHECK_NAME(glutVideoPan);
160 CHECK_NAME(glutReportErrors);
161 CHECK_NAME(glutIgnoreKeyRepeat);
162 CHECK_NAME(glutSetKeyRepeat);
164 /* freeglut extensions */
165 CHECK_NAME(glutMainLoopEvent);
166 CHECK_NAME(glutLeaveMainLoop);
167 CHECK_NAME(glutCloseFunc);
168 CHECK_NAME(glutWMCloseFunc);
169 CHECK_NAME(glutMenuDestroyFunc);
170 CHECK_NAME(glutFullScreenToggle);
171 CHECK_NAME(glutLeaveFullScreen);
172 CHECK_NAME(glutSetOption);
173 CHECK_NAME(glutGetModeValues);
174 CHECK_NAME(glutSetWindowData);
175 CHECK_NAME(glutGetWindowData);
176 CHECK_NAME(glutSetMenuData);
177 CHECK_NAME(glutGetMenuData);
178 CHECK_NAME(glutBitmapHeight);
179 CHECK_NAME(glutStrokeHeight);
180 CHECK_NAME(glutBitmapString);
181 CHECK_NAME(glutStrokeString);
182 CHECK_NAME(glutGetProcAddress);
183 CHECK_NAME(glutMouseWheelFunc);
184 CHECK_NAME(glutJoystickGetNumAxes);
185 CHECK_NAME(glutJoystickGetNumButtons);
186 CHECK_NAME(glutJoystickNotWorking);
187 CHECK_NAME(glutJoystickGetDeadBand);
188 CHECK_NAME(glutJoystickSetDeadBand);
189 CHECK_NAME(glutJoystickGetSaturation);
190 CHECK_NAME(glutJoystickSetSaturation);
191 CHECK_NAME(glutJoystickSetMinRange);
192 CHECK_NAME(glutJoystickSetMaxRange);
193 CHECK_NAME(glutJoystickSetCenter);
194 CHECK_NAME(glutJoystickGetMinRange);
195 CHECK_NAME(glutJoystickGetMaxRange);
196 CHECK_NAME(glutJoystickGetCenter);
197 CHECK_NAME(glutInitContextVersion);
198 CHECK_NAME(glutInitContextFlags);
199 CHECK_NAME(glutInitContextProfile);
200 CHECK_NAME(glutInitErrorFunc);
201 CHECK_NAME(glutInitWarningFunc);
210 glutGetProcAddress( const char *procName )
213 FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetProcAddress" );
215 /* Try GLUT functions first, then core GL functions */
216 p = fghGetGLUTProcAddress( procName );
218 /* Some GLUT functions are platform-specific: */
220 p = fgPlatformGetGLUTProcAddress( procName );
222 return ( p != NULL ) ? p : fgPlatformGetProcAddress( procName );