4 * Functions that didn't fit anywhere else...
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 <GL/freeglut.h>
33 #include "freeglut_internal.h"
36 * TODO BEFORE THE STABLE RELEASE:
40 * glutCopyColormap() --
41 * glutSetKeyRepeat() -- this is evil and should be removed from API
44 /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
47 * This functions checks if an OpenGL extension is supported or not
49 * XXX Wouldn't this be simpler and clearer if we used strtok()?
51 int FGAPIENTRY glutExtensionSupported( const char* extension )
53 const char *extensions, *start;
54 const int len = strlen( extension );
56 /* Make sure there is a current window, and thus a current context available */
57 freeglut_assert_ready;
58 freeglut_return_val_if_fail( fgStructure.Window != NULL, 0 );
60 if (strchr(extension, ' '))
62 start = extensions = (const char *) glGetString(GL_EXTENSIONS);
64 /* XXX consider printing a warning to stderr that there's no current
67 freeglut_return_val_if_fail( extensions != NULL, 0 );
70 const char *p = strstr(extensions, extension);
72 return 0; /* not found */
73 /* check that the match isn't a super string */
74 if ((p == start || p[-1] == ' ') && (p[len] == ' ' || p[len] == 0))
76 /* skip the false match and continue */
84 * This function reports all the OpenGL errors that happened till now
86 void FGAPIENTRY glutReportErrors( void )
89 while( ( error = glGetError() ) != GL_NO_ERROR )
90 fgWarning( "GL error: %s", gluErrorString( error ) );
94 * Control the auto-repeat of keystrokes to the current window
96 void FGAPIENTRY glutIgnoreKeyRepeat( int ignore )
98 freeglut_assert_ready;
99 freeglut_assert_window;
101 fgStructure.Window->State.IgnoreKeyRepeat = ignore ? GL_TRUE : GL_FALSE;
105 * Set global auto-repeat of keystrokes
107 * RepeatMode should be either:
108 * GLUT_KEY_REPEAT_OFF
110 * GLUT_KEY_REPEAT_DEFAULT
112 void FGAPIENTRY glutSetKeyRepeat( int repeatMode )
114 freeglut_assert_ready;
118 case GLUT_KEY_REPEAT_OFF:
119 case GLUT_KEY_REPEAT_ON:
120 fgState.KeyRepeat = repeatMode;
123 case GLUT_KEY_REPEAT_DEFAULT:
124 fgState.KeyRepeat = GLUT_KEY_REPEAT_ON;
128 fgError ("Invalid glutSetKeyRepeat mode: %d", repeatMode);
134 * Forces the joystick callback to be executed
136 void FGAPIENTRY glutForceJoystickFunc( void )
138 #if !TARGET_HOST_WINCE
139 freeglut_assert_ready;
140 freeglut_return_if_fail( fgStructure.Window != NULL );
141 freeglut_return_if_fail( FETCH_WCB( *( fgStructure.Window ), Joystick ) );
142 fgJoystickPollWindow( fgStructure.Window );
143 #endif /* !TARGET_HOST_WINCE */
149 void FGAPIENTRY glutSetColor( int nColor, GLfloat red, GLfloat green, GLfloat blue )
151 /* We really need to do something here. */
157 GLfloat FGAPIENTRY glutGetColor( int color, int component )
159 /* We really need to do something here. */
166 void FGAPIENTRY glutCopyColormap( int window )
168 /* We really need to do something here. */
171 /*** END OF FILE ***/