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