X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_ext.c;h=ff13adc798ea509add8b1498056f89a4503b8090;hb=c24efb9241080a043193b67c6a9718312fed8d07;hp=24acc6905d0f049d17be5d6ee2bcc890b2d81980;hpb=2e5dc871b7c1df472978af9811d0e97b6684707c;p=freeglut diff --git a/src/freeglut_ext.c b/src/freeglut_ext.c index 24acc69..ff13adc 100644 --- a/src/freeglut_ext.c +++ b/src/freeglut_ext.c @@ -25,20 +25,18 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "../include/GL/freeglut.h" +#define GLX_GLXEXT_PROTOTYPES +#include #include "freeglut_internal.h" - -struct name_address_pair { - const char *name; - void *address; +struct name_address_pair +{ + const char *name; + void *address; }; -static struct name_address_pair glut_functions[] = { +static struct name_address_pair glut_functions[] = +{ { "glutInit", (void *) glutInit }, { "glutInitDisplayMode", (void *) glutInitDisplayMode }, { "glutInitDisplayString", (void *) glutInitDisplayString }, @@ -87,7 +85,6 @@ static struct name_address_pair glut_functions[] = { { "glutReshapeFunc", (void *) glutReshapeFunc }, { "glutKeyboardFunc", (void *) glutKeyboardFunc }, { "glutMouseFunc", (void *) glutMouseFunc }, - { "glutMouseWheelFunc", (void *) glutMouseWheelFunc }, { "glutMotionFunc", (void *) glutMotionFunc }, { "glutPassiveMotionFunc", (void *) glutPassiveMotionFunc }, { "glutEntryFunc", (void *) glutEntryFunc }, @@ -108,7 +105,9 @@ static struct name_address_pair glut_functions[] = { { "glutWindowStatusFunc", (void *) glutWindowStatusFunc }, { "glutKeyboardUpFunc", (void *) glutKeyboardUpFunc }, { "glutSpecialUpFunc", (void *) glutSpecialUpFunc }, +#if !TARGET_HOST_WINCE { "glutJoystickFunc", (void *) glutJoystickFunc }, +#endif /* !TARGET_HOST_WINCE */ { "glutSetColor", (void *) glutSetColor }, { "glutGetColor", (void *) glutGetColor }, { "glutCopyColormap", (void *) glutCopyColormap }, @@ -149,11 +148,13 @@ static struct name_address_pair glut_functions[] = { { "glutReportErrors", (void *) glutReportErrors }, { "glutIgnoreKeyRepeat", (void *) glutIgnoreKeyRepeat }, { "glutSetKeyRepeat", (void *) glutSetKeyRepeat }, +#if !TARGET_HOST_WINCE { "glutForceJoystickFunc", (void *) glutForceJoystickFunc }, { "glutGameModeString", (void *) glutGameModeString }, { "glutEnterGameMode", (void *) glutEnterGameMode }, { "glutLeaveGameMode", (void *) glutLeaveGameMode }, { "glutGameModeGet", (void *) glutGameModeGet }, +#endif /* !TARGET_HOST_WINCE */ /* freeglut extensions */ { "glutMainLoopEvent", (void *) glutMainLoopEvent }, { "glutLeaveMainLoop", (void *) glutLeaveMainLoop }, @@ -174,25 +175,26 @@ static struct name_address_pair glut_functions[] = { { "glutWireSierpinskiSponge ", (void *) glutWireSierpinskiSponge }, { "glutSolidSierpinskiSponge ", (void *) glutSolidSierpinskiSponge }, { "glutGetProcAddress", (void *) glutGetProcAddress }, + { "glutMouseWheelFunc", (void *) glutMouseWheelFunc }, { NULL, NULL } -}; +}; -void * FGAPIENTRY glutGetProcAddress(const char *procName) +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 GLUT functions first */ + int i; + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetProcAddress" ); + 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); + /* Try core GL functions */ +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE + 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; + return NULL; #endif }