Back to index

extremetuxracer  0.5beta
gl_util.h
Go to the documentation of this file.
00001 /* 
00002  * PPRacer 
00003  * Copyright (C) 2004-2005 Volker Stroebel <volker@planetpenguin.de>
00004  *
00005  * Copyright (C) 1999-2001 Jasmin F. Patry
00006  * 
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  */
00021  
00022 #ifndef _GL_UTIL_H_
00023 #define _GL_UTIL_H_
00024 
00025 #include "etracer.h"
00026 
00027 /* Hack to fix compiling problem with old gl.h's, reported by Steve
00028    Baker <sjbaker1@airmail.net>.  Some old gl.h's don't include glext.h, but
00029    do this:
00030 
00031    #define GL_EXT_compiled_vertex_array    1
00032 
00033    since they do define the glLockArraysEXT/glUnlockArraysEXT
00034    functions.  However, this prevents PFNGLLOCKARRAYSEXTPROC /
00035    PFNGLUNLOCKARRAYSEXTPROC from being defined in glext.h.  So, we do
00036    the following, which at worst results in a warning (and is awfully
00037    ugly):
00038 
00039    #undef GL_EXT_compiled_vertex_array
00040 
00041    The *correct* thing to do would be for gl.h to #include glext.h, as
00042    recent gl.h's do.  However, versions of Mesa as recent as 3.2.1
00043    don't do this, so we have to work around it.
00044 */
00045 #undef GL_EXT_compiled_vertex_array
00046 
00047 /* Shouldn't need to include glext.h if gl.h is recent, but alas we can't
00048  * count on that...  */
00049 #include <GL/glext.h>
00050 
00051 #if !defined(GL_GLEXT_VERSION) || GL_GLEXT_VERSION < 6
00052 #   error "*** You need a more recent copy of glext.h.  You can get one at http://oss.sgi.com/projects/ogl-sample/ABI/glext.h ; it goes in /usr/include/GL. ***"
00053 #endif
00054 
00055 // support for systems where there is no need to retrieve pointers to these functions (e.g. mac OS X)
00056 #if defined(__APPLE__) && !defined(GL_GLEXT_FUNCTION_POINTERS)
00057 #define NO_FUNCTION_POINTERS
00058 #endif
00059 
00060 #ifndef NO_FUNCTION_POINTERS
00061 extern PFNGLLOCKARRAYSEXTPROC glLockArraysEXT_p;
00062 extern PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT_p;
00063 #else
00064 #define glLockArraysEXT_p glLockArraysEXT
00065 #define glUnlockArraysEXT_p glUnlockArraysEXT
00066 #endif
00067 
00068 typedef enum {
00069     GUI,
00070     GAUGE_BARS,
00071     TEXFONT,
00072     TEXT,
00073     COURSE,
00074     TREES,
00075     PARTICLES,
00076     PARTICLE_SHADOWS,
00077     BACKGROUND,
00078     TUX,
00079     TUX_SHADOW,
00080     SKY,
00081     FOG_PLANE,
00082     TRACK_MARKS,
00083     OVERLAYS, 
00084     SPLASH_SCREEN
00085 } RenderMode;
00086 
00087 void set_gl_options( const RenderMode mode );
00088 
00089 void copy_to_glfloat_array( GLfloat dest[], double src[], int n );
00090 
00091 void init_glfloat_array( int num, GLfloat arr[], ... );
00092 
00093 void init_opengl_extensions();
00094 
00095 void print_gl_info();
00096 
00097 #endif