added glutGetProcAddress()

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@65 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
brianp 2003-06-17 16:54:54 +00:00
parent 449e4c1014
commit 863ce91b8e
4 changed files with 202 additions and 0 deletions

1
.gitattributes vendored
View File

@ -24,6 +24,7 @@ freeglut/freeglut/freeglut-1.3/Makefile.am svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut-1.3/freeglut_callbacks.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut-1.3/freeglut_callbacks.c svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut-1.3/freeglut_cursor.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut-1.3/freeglut_cursor.c svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut-1.3/freeglut_display.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut-1.3/freeglut_display.c svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut-1.3/freeglut_ext.c svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut-1.3/freeglut_font.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut-1.3/freeglut_font.c svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut-1.3/freeglut_font_data.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut-1.3/freeglut_font_data.c svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut-1.3/freeglut_gamemode.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut-1.3/freeglut_gamemode.c svn_keywords=Author+Date+Id+Revision

View File

@ -11,6 +11,7 @@ lib_LTLIBRARIES = libfreeglut-1.3.la
libfreeglut_1_3_la_SOURCES = freeglut_callbacks.c \ libfreeglut_1_3_la_SOURCES = freeglut_callbacks.c \
freeglut_cursor.c \ freeglut_cursor.c \
freeglut_display.c \ freeglut_display.c \
freeglut_ext.c \
freeglut_font.c \ freeglut_font.c \
freeglut_font_data.c \ freeglut_font_data.c \
freeglut_stroke_roman.c \ freeglut_stroke_roman.c \

View File

@ -0,0 +1,194 @@
/*
* freeglut_ext.c
*
* Functions related to OpenGL extensions.
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 9 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define G_LOG_DOMAIN "freeglut-ext"
#include "../include/GL/freeglut.h"
#include "freeglut_internal.h"
struct name_address_pair {
const char *name;
void *address;
};
static struct name_address_pair glut_functions[] = {
{ "glutInit", (void *) glutInit },
{ "glutInitDisplayMode", (void *) glutInitDisplayMode },
{ "glutInitDisplayString", (void *) glutInitDisplayString },
{ "glutInitWindowPosition", (void *) glutInitWindowPosition },
{ "glutInitWindowSize", (void *) glutInitWindowSize },
{ "glutMainLoop", (void *) glutMainLoop },
{ "glutCreateWindow", (void *) glutCreateWindow },
{ "glutCreateSubWindow", (void *) glutCreateSubWindow },
{ "glutDestroyWindow", (void *) glutDestroyWindow },
{ "glutPostRedisplay", (void *) glutPostRedisplay },
{ "glutPostWindowRedisplay", (void *) glutPostWindowRedisplay },
{ "glutSwapBuffers", (void *) glutSwapBuffers },
{ "glutGetWindow", (void *) glutGetWindow },
{ "glutSetWindow", (void *) glutSetWindow },
{ "glutSetWindowTitle", (void *) glutSetWindowTitle },
{ "glutSetIconTitle", (void *) glutSetIconTitle },
{ "glutPositionWindow", (void *) glutPositionWindow },
{ "glutReshapeWindow", (void *) glutReshapeWindow },
{ "glutPopWindow", (void *) glutPopWindow },
{ "glutPushWindow", (void *) glutPushWindow },
{ "glutIconifyWindow", (void *) glutIconifyWindow },
{ "glutShowWindow", (void *) glutShowWindow },
{ "glutHideWindow", (void *) glutHideWindow },
{ "glutFullScreen", (void *) glutFullScreen },
{ "glutSetCursor", (void *) glutSetCursor },
{ "glutWarpPointer", (void *) glutWarpPointer },
{ "glutEstablishOverlay", (void *) glutEstablishOverlay },
{ "glutRemoveOverlay", (void *) glutRemoveOverlay },
{ "glutUseLayer", (void *) glutUseLayer },
{ "glutPostOverlayRedisplay", (void *) glutPostOverlayRedisplay },
{ "glutPostWindowOverlayRedisplay", (void *) glutPostWindowOverlayRedisplay },
{ "glutShowOverlay", (void *) glutShowOverlay },
{ "glutHideOverlay", (void *) glutHideOverlay },
{ "glutCreateMenu", (void *) glutCreateMenu },
{ "glutDestroyMenu", (void *) glutDestroyMenu },
{ "glutGetMenu", (void *) glutGetMenu },
{ "glutSetMenu", (void *) glutSetMenu },
{ "glutAddMenuEntry", (void *) glutAddMenuEntry },
{ "glutAddSubMenu", (void *) glutAddSubMenu },
{ "glutChangeToMenuEntry", (void *) glutChangeToMenuEntry },
{ "glutChangeToSubMenu", (void *) glutChangeToSubMenu },
{ "glutRemoveMenuItem", (void *) glutRemoveMenuItem },
{ "glutAttachMenu", (void *) glutAttachMenu },
{ "glutDetachMenu", (void *) glutDetachMenu },
{ "glutDisplayFunc", (void *) glutDisplayFunc },
{ "glutReshapeFunc", (void *) glutReshapeFunc },
{ "glutKeyboardFunc", (void *) glutKeyboardFunc },
{ "glutMouseFunc", (void *) glutMouseFunc },
{ "glutMotionFunc", (void *) glutMotionFunc },
{ "glutPassiveMotionFunc", (void *) glutPassiveMotionFunc },
{ "glutEntryFunc", (void *) glutEntryFunc },
{ "glutVisibilityFunc", (void *) glutVisibilityFunc },
{ "glutIdleFunc", (void *) glutIdleFunc },
{ "glutTimerFunc", (void *) glutTimerFunc },
{ "glutMenuStateFunc", (void *) glutMenuStateFunc },
{ "glutSpecialFunc", (void *) glutSpecialFunc },
{ "glutSpaceballMotionFunc", (void *) glutSpaceballMotionFunc },
{ "glutSpaceballRotateFunc", (void *) glutSpaceballRotateFunc },
{ "glutSpaceballButtonFunc", (void *) glutSpaceballButtonFunc },
{ "glutButtonBoxFunc", (void *) glutButtonBoxFunc },
{ "glutDialsFunc", (void *) glutDialsFunc },
{ "glutTabletMotionFunc", (void *) glutTabletMotionFunc },
{ "glutTabletButtonFunc", (void *) glutTabletButtonFunc },
{ "glutMenuStatusFunc", (void *) glutMenuStatusFunc },
{ "glutOverlayDisplayFunc", (void *) glutOverlayDisplayFunc },
{ "glutWindowStatusFunc", (void *) glutWindowStatusFunc },
{ "glutKeyboardUpFunc", (void *) glutKeyboardUpFunc },
{ "glutSpecialUpFunc", (void *) glutSpecialUpFunc },
{ "glutJoystickFunc", (void *) glutJoystickFunc },
{ "glutSetColor", (void *) glutSetColor },
{ "glutGetColor", (void *) glutGetColor },
{ "glutCopyColormap", (void *) glutCopyColormap },
{ "glutGet", (void *) glutGet },
{ "glutDeviceGet", (void *) glutDeviceGet },
{ "glutExtensionSupported", (void *) glutExtensionSupported },
{ "glutGetModifiers", (void *) glutGetModifiers },
{ "glutLayerGet", (void *) glutLayerGet },
{ "glutBitmapCharacter", (void *) glutBitmapCharacter },
{ "glutBitmapWidth", (void *) glutBitmapWidth },
{ "glutStrokeCharacter", (void *) glutStrokeCharacter },
{ "glutStrokeWidth", (void *) glutStrokeWidth },
{ "glutBitmapLength", (void *) glutBitmapLength },
{ "glutStrokeLength", (void *) glutStrokeLength },
{ "glutWireSphere", (void *) glutWireSphere },
{ "glutSolidSphere", (void *) glutSolidSphere },
{ "glutWireCone", (void *) glutWireCone },
{ "glutSolidCone", (void *) glutSolidCone },
{ "glutWireCube", (void *) glutWireCube },
{ "glutSolidCube", (void *) glutSolidCube },
{ "glutWireTorus", (void *) glutWireTorus },
{ "glutSolidTorus", (void *) glutSolidTorus },
{ "glutWireDodecahedron", (void *) glutWireDodecahedron },
{ "glutSolidDodecahedron", (void *) glutSolidDodecahedron },
{ "glutWireTeapot", (void *) glutWireTeapot },
{ "glutSolidTeapot", (void *) glutSolidTeapot },
{ "glutWireOctahedron", (void *) glutWireOctahedron },
{ "glutSolidOctahedron", (void *) glutSolidOctahedron },
{ "glutWireTetrahedron", (void *) glutWireTetrahedron },
{ "glutSolidTetrahedron", (void *) glutSolidTetrahedron },
{ "glutWireIcosahedron", (void *) glutWireIcosahedron },
{ "glutSolidIcosahedron", (void *) glutSolidIcosahedron },
{ "glutVideoResizeGet", (void *) glutVideoResizeGet },
{ "glutSetupVideoResizing", (void *) glutSetupVideoResizing },
{ "glutStopVideoResizing", (void *) glutStopVideoResizing },
{ "glutVideoResize", (void *) glutVideoResize },
{ "glutVideoPan", (void *) glutVideoPan },
{ "glutReportErrors", (void *) glutReportErrors },
{ "glutIgnoreKeyRepeat", (void *) glutIgnoreKeyRepeat },
{ "glutSetKeyRepeat", (void *) glutSetKeyRepeat },
{ "glutForceJoystickFunc", (void *) glutForceJoystickFunc },
{ "glutGameModeString", (void *) glutGameModeString },
{ "glutEnterGameMode", (void *) glutEnterGameMode },
{ "glutLeaveGameMode", (void *) glutLeaveGameMode },
{ "glutGameModeGet", (void *) glutGameModeGet },
/* FreeGLUT extensions */
{ "glutMainLoopEvent", (void *) glutMainLoopEvent },
{ "glutLeaveMainLoop", (void *) glutLeaveMainLoop },
{ "glutCloseFunc", (void *) glutCloseFunc },
{ "glutWMCloseFunc", (void *) glutWMCloseFunc },
{ "glutSetOption ", (void *) glutSetOption },
{ "glutBitmapHeight", (void *) glutBitmapHeight },
{ "glutStrokeHeight", (void *) glutStrokeHeight },
{ "glutBitmapString", (void *) glutBitmapString },
{ "glutStrokeString", (void *) glutStrokeString },
{ "glutWireRhombicDodecahedron", (void *) glutWireRhombicDodecahedron },
{ "glutSolidRhombicDodecahedron", (void *) glutSolidRhombicDodecahedron },
{ "glutWireSierpinskiSponge ", (void *) glutWireSierpinskiSponge },
{ "glutSolidSierpinskiSponge ", (void *) glutSolidSierpinskiSponge },
{ "glutGetProcAddress", (void *) glutGetProcAddress },
{ NULL, NULL }
};
void * FGAPIENTRY glutGetProcAddress(const char *procName)
{
/* Try GLUT functions first */
int i;
for (i = 0; glut_functions[i].name; i++) {
if (strcmp(glut_functions[i].name, procName) == 0)
return glut_functions[i].address;
}
/* Try core GL functions */
#if TARGET_HOST_WIN32
return (void *) wglGetProcAddress((LPCSTR) procName);
#elif TARGET_HOST_UNIX_X11 && defined(GLX_ARB_get_proc_address)
return (void *) glXGetProcAddressARB((const GLubyte *) procName);
#else
return NULL;
#endif
}

View File

@ -80,6 +80,12 @@ FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLfloat offset[3], GLfloat scale ) ; FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLfloat offset[3], GLfloat scale ) ;
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLfloat offset[3], GLfloat scale ) ; FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, GLfloat offset[3], GLfloat scale ) ;
/*
* Extension functions, see freeglut_ext.c
*/
FGAPI void * FGAPIENTRY glutGetProcAddress( const char *procName );
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif