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.
32 #include "../include/GL/freeglut.h"
33 #include "freeglut_internal.h"
36 struct name_address_pair {
41 static struct name_address_pair glut_functions[] = {
42 { "glutInit", (void *) glutInit },
43 { "glutInitDisplayMode", (void *) glutInitDisplayMode },
44 { "glutInitDisplayString", (void *) glutInitDisplayString },
45 { "glutInitWindowPosition", (void *) glutInitWindowPosition },
46 { "glutInitWindowSize", (void *) glutInitWindowSize },
47 { "glutMainLoop", (void *) glutMainLoop },
48 { "glutCreateWindow", (void *) glutCreateWindow },
49 { "glutCreateSubWindow", (void *) glutCreateSubWindow },
50 { "glutDestroyWindow", (void *) glutDestroyWindow },
51 { "glutPostRedisplay", (void *) glutPostRedisplay },
52 { "glutPostWindowRedisplay", (void *) glutPostWindowRedisplay },
53 { "glutSwapBuffers", (void *) glutSwapBuffers },
54 { "glutGetWindow", (void *) glutGetWindow },
55 { "glutSetWindow", (void *) glutSetWindow },
56 { "glutSetWindowTitle", (void *) glutSetWindowTitle },
57 { "glutSetIconTitle", (void *) glutSetIconTitle },
58 { "glutPositionWindow", (void *) glutPositionWindow },
59 { "glutReshapeWindow", (void *) glutReshapeWindow },
60 { "glutPopWindow", (void *) glutPopWindow },
61 { "glutPushWindow", (void *) glutPushWindow },
62 { "glutIconifyWindow", (void *) glutIconifyWindow },
63 { "glutShowWindow", (void *) glutShowWindow },
64 { "glutHideWindow", (void *) glutHideWindow },
65 { "glutFullScreen", (void *) glutFullScreen },
66 { "glutSetCursor", (void *) glutSetCursor },
67 { "glutWarpPointer", (void *) glutWarpPointer },
68 { "glutEstablishOverlay", (void *) glutEstablishOverlay },
69 { "glutRemoveOverlay", (void *) glutRemoveOverlay },
70 { "glutUseLayer", (void *) glutUseLayer },
71 { "glutPostOverlayRedisplay", (void *) glutPostOverlayRedisplay },
72 { "glutPostWindowOverlayRedisplay", (void *) glutPostWindowOverlayRedisplay },
73 { "glutShowOverlay", (void *) glutShowOverlay },
74 { "glutHideOverlay", (void *) glutHideOverlay },
75 { "glutCreateMenu", (void *) glutCreateMenu },
76 { "glutDestroyMenu", (void *) glutDestroyMenu },
77 { "glutGetMenu", (void *) glutGetMenu },
78 { "glutSetMenu", (void *) glutSetMenu },
79 { "glutAddMenuEntry", (void *) glutAddMenuEntry },
80 { "glutAddSubMenu", (void *) glutAddSubMenu },
81 { "glutChangeToMenuEntry", (void *) glutChangeToMenuEntry },
82 { "glutChangeToSubMenu", (void *) glutChangeToSubMenu },
83 { "glutRemoveMenuItem", (void *) glutRemoveMenuItem },
84 { "glutAttachMenu", (void *) glutAttachMenu },
85 { "glutDetachMenu", (void *) glutDetachMenu },
86 { "glutDisplayFunc", (void *) glutDisplayFunc },
87 { "glutReshapeFunc", (void *) glutReshapeFunc },
88 { "glutKeyboardFunc", (void *) glutKeyboardFunc },
89 { "glutMouseFunc", (void *) glutMouseFunc },
90 { "glutMouseWheelFunc", (void *) glutMouseWheelFunc },
91 { "glutMotionFunc", (void *) glutMotionFunc },
92 { "glutPassiveMotionFunc", (void *) glutPassiveMotionFunc },
93 { "glutEntryFunc", (void *) glutEntryFunc },
94 { "glutVisibilityFunc", (void *) glutVisibilityFunc },
95 { "glutIdleFunc", (void *) glutIdleFunc },
96 { "glutTimerFunc", (void *) glutTimerFunc },
97 { "glutMenuStateFunc", (void *) glutMenuStateFunc },
98 { "glutSpecialFunc", (void *) glutSpecialFunc },
99 { "glutSpaceballMotionFunc", (void *) glutSpaceballMotionFunc },
100 { "glutSpaceballRotateFunc", (void *) glutSpaceballRotateFunc },
101 { "glutSpaceballButtonFunc", (void *) glutSpaceballButtonFunc },
102 { "glutButtonBoxFunc", (void *) glutButtonBoxFunc },
103 { "glutDialsFunc", (void *) glutDialsFunc },
104 { "glutTabletMotionFunc", (void *) glutTabletMotionFunc },
105 { "glutTabletButtonFunc", (void *) glutTabletButtonFunc },
106 { "glutMenuStatusFunc", (void *) glutMenuStatusFunc },
107 { "glutOverlayDisplayFunc", (void *) glutOverlayDisplayFunc },
108 { "glutWindowStatusFunc", (void *) glutWindowStatusFunc },
109 { "glutKeyboardUpFunc", (void *) glutKeyboardUpFunc },
110 { "glutSpecialUpFunc", (void *) glutSpecialUpFunc },
111 { "glutJoystickFunc", (void *) glutJoystickFunc },
112 { "glutSetColor", (void *) glutSetColor },
113 { "glutGetColor", (void *) glutGetColor },
114 { "glutCopyColormap", (void *) glutCopyColormap },
115 { "glutGet", (void *) glutGet },
116 { "glutDeviceGet", (void *) glutDeviceGet },
117 { "glutExtensionSupported", (void *) glutExtensionSupported },
118 { "glutGetModifiers", (void *) glutGetModifiers },
119 { "glutLayerGet", (void *) glutLayerGet },
120 { "glutBitmapCharacter", (void *) glutBitmapCharacter },
121 { "glutBitmapWidth", (void *) glutBitmapWidth },
122 { "glutStrokeCharacter", (void *) glutStrokeCharacter },
123 { "glutStrokeWidth", (void *) glutStrokeWidth },
124 { "glutBitmapLength", (void *) glutBitmapLength },
125 { "glutStrokeLength", (void *) glutStrokeLength },
126 { "glutWireSphere", (void *) glutWireSphere },
127 { "glutSolidSphere", (void *) glutSolidSphere },
128 { "glutWireCone", (void *) glutWireCone },
129 { "glutSolidCone", (void *) glutSolidCone },
130 { "glutWireCube", (void *) glutWireCube },
131 { "glutSolidCube", (void *) glutSolidCube },
132 { "glutWireTorus", (void *) glutWireTorus },
133 { "glutSolidTorus", (void *) glutSolidTorus },
134 { "glutWireDodecahedron", (void *) glutWireDodecahedron },
135 { "glutSolidDodecahedron", (void *) glutSolidDodecahedron },
136 { "glutWireTeapot", (void *) glutWireTeapot },
137 { "glutSolidTeapot", (void *) glutSolidTeapot },
138 { "glutWireOctahedron", (void *) glutWireOctahedron },
139 { "glutSolidOctahedron", (void *) glutSolidOctahedron },
140 { "glutWireTetrahedron", (void *) glutWireTetrahedron },
141 { "glutSolidTetrahedron", (void *) glutSolidTetrahedron },
142 { "glutWireIcosahedron", (void *) glutWireIcosahedron },
143 { "glutSolidIcosahedron", (void *) glutSolidIcosahedron },
144 { "glutVideoResizeGet", (void *) glutVideoResizeGet },
145 { "glutSetupVideoResizing", (void *) glutSetupVideoResizing },
146 { "glutStopVideoResizing", (void *) glutStopVideoResizing },
147 { "glutVideoResize", (void *) glutVideoResize },
148 { "glutVideoPan", (void *) glutVideoPan },
149 { "glutReportErrors", (void *) glutReportErrors },
150 { "glutIgnoreKeyRepeat", (void *) glutIgnoreKeyRepeat },
151 { "glutSetKeyRepeat", (void *) glutSetKeyRepeat },
152 { "glutForceJoystickFunc", (void *) glutForceJoystickFunc },
153 { "glutGameModeString", (void *) glutGameModeString },
154 { "glutEnterGameMode", (void *) glutEnterGameMode },
155 { "glutLeaveGameMode", (void *) glutLeaveGameMode },
156 { "glutGameModeGet", (void *) glutGameModeGet },
157 /* freeglut extensions */
158 { "glutMainLoopEvent", (void *) glutMainLoopEvent },
159 { "glutLeaveMainLoop", (void *) glutLeaveMainLoop },
160 { "glutCloseFunc", (void *) glutCloseFunc },
161 { "glutWMCloseFunc", (void *) glutWMCloseFunc },
162 { "glutMenuDestroyFunc", (void *) glutMenuDestroyFunc },
163 { "glutSetOption", (void *) glutSetOption },
164 { "glutSetWindowData", (void *) glutSetWindowData },
165 { "glutGetWindowData", (void *) glutGetWindowData },
166 { "glutSetMenuData", (void *) glutSetMenuData },
167 { "glutGetMenuData", (void *) glutGetMenuData },
168 { "glutBitmapHeight", (void *) glutBitmapHeight },
169 { "glutStrokeHeight", (void *) glutStrokeHeight },
170 { "glutBitmapString", (void *) glutBitmapString },
171 { "glutStrokeString", (void *) glutStrokeString },
172 { "glutWireRhombicDodecahedron", (void *) glutWireRhombicDodecahedron },
173 { "glutSolidRhombicDodecahedron", (void *) glutSolidRhombicDodecahedron },
174 { "glutWireSierpinskiSponge ", (void *) glutWireSierpinskiSponge },
175 { "glutSolidSierpinskiSponge ", (void *) glutSolidSierpinskiSponge },
176 { "glutGetProcAddress", (void *) glutGetProcAddress },
181 void * FGAPIENTRY glutGetProcAddress(const char *procName)
183 /* Try GLUT functions first */
185 for (i = 0; glut_functions[i].name; i++) {
186 if (strcmp(glut_functions[i].name, procName) == 0)
187 return glut_functions[i].address;
190 /* Try core GL functions */
191 #if TARGET_HOST_WIN32
192 return (void *) wglGetProcAddress((LPCSTR) procName);
193 #elif TARGET_HOST_UNIX_X11 && defined(GLX_ARB_get_proc_address)
194 return (void *) glXGetProcAddressARB((const GLubyte *) procName);