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