Added platform independent OpenGL header - SDL_opengl.h
authorSam Lantinga <slouken@libsdl.org>
Thu, 25 Oct 2001 05:37:32 +0000
changeset 214 0e5d6dd77bda
parent 213 c79890792bfb
child 215 041cd6816a05
Added platform independent OpenGL header - SDL_opengl.h
docs.html
include/Makefile.am
include/SDL_opengl.h
test/configure.in
test/testgl.c
--- a/docs.html	Thu Oct 25 04:35:42 2001 +0000
+++ b/docs.html	Thu Oct 25 05:37:32 2001 +0000
@@ -16,6 +16,7 @@
 Major changes since SDL 1.0.0:
 </H2>
 <UL>
+	<LI> 1.2.3: Added platform independent OpenGL header - SDL_opengl.h
 	<LI> 1.2.3: Fixed flashing the screen when creating a window on BeOS
 	<LI> 1.2.3: Added double-buffering support for SVGAlib (thanks Kutak!)
 	<LI> 1.2.3: Fixed crash when using double-buffering with DGA
--- a/include/Makefile.am	Thu Oct 25 04:35:42 2001 +0000
+++ b/include/Makefile.am	Thu Oct 25 05:37:32 2001 +0000
@@ -21,6 +21,7 @@
 	SDL_main.h		\
 	SDL_mouse.h		\
 	SDL_mutex.h		\
+	SDL_opengl.h		\
 	SDL_quit.h		\
 	SDL_rwops.h		\
 	SDL_syswm.h		\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/SDL_opengl.h	Thu Oct 25 05:37:32 2001 +0000
@@ -0,0 +1,307 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@devolution.com
+*/
+
+#ifdef SAVE_RCSID
+static char rcsid =
+ "@(#) $Id$";
+#endif
+
+/* This is a simple file to encapsulate the OpenGL API headers */
+
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+#if defined(__APPLE__) && defined(__MACH__)
+#include <OpenGL/gl.h>	/* Header File For The OpenGL Library */
+#include <OpenGL/glu.h>	/* Header File For The GLU Library */
+#else
+#ifndef NO_SDL_GLEXT
+#define __glext_h_  /* Don't let gl.h include glext.h */
+#endif
+#include <GL/gl.h>	/* Header File For The OpenGL Library */
+#include <GL/glu.h>	/* Header File For The GLU Library */
+#ifndef NO_SDL_GLEXT
+#undef __glext_h_
+#endif
+#endif
+
+/* This file taken from "GLext.h" from the Jeff Molofee OpenGL tutorials.
+   It is included here because glext.h is not available on some systems.
+   If you don't want this version included, simply define "NO_SDL_GLEXT"
+ */
+#ifndef NO_SDL_GLEXT
+#ifndef __glext_h_
+#define __glext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
+/*
+** Copyright 1992-1999 Silicon Graphics, Inc.
+** All Rights Reserved.
+**
+** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
+** the contents of this file may not be disclosed to third parties, copied or
+** duplicated in any form, in whole or in part, without the prior written
+** permission of Silicon Graphics, Inc.
+**
+** RESTRICTED RIGHTS LEGEND:
+** Use, duplication or disclosure by the Government is subject to restrictions
+** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
+** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
+** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
+** rights reserved under the Copyright Laws of the United States.
+*/
+
+#define GL_ARB_multitexture                 1
+#define GL_EXT_abgr                         1
+#define GL_EXT_bgra                         1
+#define GL_EXT_clip_volume_hint             1
+#define GL_EXT_compiled_vertex_array        1
+#define GL_EXT_cull_vertex                  1
+#define GL_EXT_packed_pixels                1
+#define GL_EXT_point_parameters             1
+#define GL_EXT_stencil_wrap                 1
+#define GL_EXT_texture_env_add              1
+#define GL_EXT_texture_env_combine          1
+#define GL_EXT_vertex_array                 1
+#define GL_NV_texgen_reflection             1
+#define GL_NV_texture_env_combine4          1
+#define GL_WIN_swap_hint                    1
+
+/* EXT_abgr */
+#define GL_ABGR_EXT                         0x8000
+
+/* EXT_packed_pixels */
+#define GL_UNSIGNED_BYTE_3_3_2_EXT          0x8032
+#define GL_UNSIGNED_SHORT_4_4_4_4_EXT       0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1_EXT       0x8034
+#define GL_UNSIGNED_INT_8_8_8_8_EXT         0x8035
+#define GL_UNSIGNED_INT_10_10_10_2_EXT      0x8036
+
+/* EXT_vertex_array */
+#define GL_VERTEX_ARRAY_EXT                 0x8074
+#define GL_NORMAL_ARRAY_EXT                 0x8075
+#define GL_COLOR_ARRAY_EXT                  0x8076
+#define GL_INDEX_ARRAY_EXT                  0x8077
+#define GL_TEXTURE_COORD_ARRAY_EXT          0x8078
+#define GL_EDGE_FLAG_ARRAY_EXT              0x8079
+#define GL_VERTEX_ARRAY_SIZE_EXT            0x807A
+#define GL_VERTEX_ARRAY_TYPE_EXT            0x807B
+#define GL_VERTEX_ARRAY_STRIDE_EXT          0x807C
+#define GL_VERTEX_ARRAY_COUNT_EXT           0x807D
+#define GL_NORMAL_ARRAY_TYPE_EXT            0x807E
+#define GL_NORMAL_ARRAY_STRIDE_EXT          0x807F
+#define GL_NORMAL_ARRAY_COUNT_EXT           0x8080
+#define GL_COLOR_ARRAY_SIZE_EXT             0x8081
+#define GL_COLOR_ARRAY_TYPE_EXT             0x8082
+#define GL_COLOR_ARRAY_STRIDE_EXT           0x8083
+#define GL_COLOR_ARRAY_COUNT_EXT            0x8084
+#define GL_INDEX_ARRAY_TYPE_EXT             0x8085
+#define GL_INDEX_ARRAY_STRIDE_EXT           0x8086
+#define GL_INDEX_ARRAY_COUNT_EXT            0x8087
+#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT     0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT     0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT   0x808A
+#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT    0x808B
+#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT       0x808C
+#define GL_EDGE_FLAG_ARRAY_COUNT_EXT        0x808D
+#define GL_VERTEX_ARRAY_POINTER_EXT         0x808E
+#define GL_NORMAL_ARRAY_POINTER_EXT         0x808F
+#define GL_COLOR_ARRAY_POINTER_EXT          0x8090
+#define GL_INDEX_ARRAY_POINTER_EXT          0x8091
+#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT  0x8092
+#define GL_EDGE_FLAG_ARRAY_POINTER_EXT      0x8093
+
+/* EXT_bgra */
+#define GL_BGR_EXT                          0x80E0
+#define GL_BGRA_EXT                         0x80E1
+
+/* EXT_clip_volume_hint */
+#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT    0x80F0
+
+/* EXT_point_parameters */
+#define GL_POINT_SIZE_MIN_EXT               0x8126
+#define GL_POINT_SIZE_MAX_EXT               0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE_EXT    0x8128
+#define GL_DISTANCE_ATTENUATION_EXT         0x8129
+
+/* EXT_compiled_vertex_array */
+#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT     0x81A8
+#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT     0x81A9
+
+/* EXT_cull_vertex */
+#define GL_CULL_VERTEX_EXT                  0x81AA
+#define GL_CULL_VERTEX_EYE_POSITION_EXT     0x81AB
+#define GL_CULL_VERTEX_OBJECT_POSITION_EXT  0x81AC
+
+/* ARB_multitexture */
+#define GL_ACTIVE_TEXTURE_ARB               0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE_ARB        0x84E1
+#define GL_MAX_TEXTURE_UNITS_ARB            0x84E2
+#define GL_TEXTURE0_ARB                     0x84C0
+#define GL_TEXTURE1_ARB                     0x84C1
+#define GL_TEXTURE2_ARB                     0x84C2
+#define GL_TEXTURE3_ARB                     0x84C3
+#define GL_TEXTURE4_ARB                     0x84C4
+#define GL_TEXTURE5_ARB                     0x84C5
+#define GL_TEXTURE6_ARB                     0x84C6
+#define GL_TEXTURE7_ARB                     0x84C7
+#define GL_TEXTURE8_ARB                     0x84C8
+#define GL_TEXTURE9_ARB                     0x84C9
+#define GL_TEXTURE10_ARB                    0x84CA
+#define GL_TEXTURE11_ARB                    0x84CB
+#define GL_TEXTURE12_ARB                    0x84CC
+#define GL_TEXTURE13_ARB                    0x84CD
+#define GL_TEXTURE14_ARB                    0x84CE
+#define GL_TEXTURE15_ARB                    0x84CF
+#define GL_TEXTURE16_ARB                    0x84D0
+#define GL_TEXTURE17_ARB                    0x84D1
+#define GL_TEXTURE18_ARB                    0x84D2
+#define GL_TEXTURE19_ARB                    0x84D3
+#define GL_TEXTURE20_ARB                    0x84D4
+#define GL_TEXTURE21_ARB                    0x84D5
+#define GL_TEXTURE22_ARB                    0x84D6
+#define GL_TEXTURE23_ARB                    0x84D7
+#define GL_TEXTURE24_ARB                    0x84D8
+#define GL_TEXTURE25_ARB                    0x84D9
+#define GL_TEXTURE26_ARB                    0x84DA
+#define GL_TEXTURE27_ARB                    0x84DB
+#define GL_TEXTURE28_ARB                    0x84DC
+#define GL_TEXTURE29_ARB                    0x84DD
+#define GL_TEXTURE30_ARB                    0x84DE
+#define GL_TEXTURE31_ARB                    0x84DF
+
+/* EXT_stencil_wrap */
+#define GL_INCR_WRAP_EXT                    0x8507
+#define GL_DECR_WRAP_EXT                    0x8508
+
+/* NV_texgen_reflection */
+#define GL_NORMAL_MAP_NV                    0x8511
+#define GL_REFLECTION_MAP_NV                0x8512
+
+/* EXT_texture_env_combine */
+#define GL_COMBINE_EXT                      0x8570
+#define GL_COMBINE_RGB_EXT                  0x8571
+#define GL_COMBINE_ALPHA_EXT                0x8572
+#define GL_RGB_SCALE_EXT                    0x8573
+#define GL_ADD_SIGNED_EXT                   0x8574
+#define GL_INTERPOLATE_EXT                  0x8575
+#define GL_CONSTANT_EXT                     0x8576
+#define GL_PRIMARY_COLOR_EXT                0x8577
+#define GL_PREVIOUS_EXT                     0x8578
+#define GL_SOURCE0_RGB_EXT                  0x8580
+#define GL_SOURCE1_RGB_EXT                  0x8581
+#define GL_SOURCE2_RGB_EXT                  0x8582
+#define GL_SOURCE0_ALPHA_EXT                0x8588
+#define GL_SOURCE1_ALPHA_EXT                0x8589
+#define GL_SOURCE2_ALPHA_EXT                0x858A
+#define GL_OPERAND0_RGB_EXT                 0x8590
+#define GL_OPERAND1_RGB_EXT                 0x8591
+#define GL_OPERAND2_RGB_EXT                 0x8592
+#define GL_OPERAND0_ALPHA_EXT               0x8598
+#define GL_OPERAND1_ALPHA_EXT               0x8599
+#define GL_OPERAND2_ALPHA_EXT               0x859A
+
+/* NV_texture_env_combine4 */
+#define GL_COMBINE4_NV                      0x8503
+#define GL_SOURCE3_RGB_NV                   0x8583
+#define GL_SOURCE3_ALPHA_NV                 0x858B
+#define GL_OPERAND3_RGB_NV                  0x8593
+#define GL_OPERAND3_ALPHA_NV                0x859B
+
+/*************************************************************/
+
+/* EXT_vertex_array */
+typedef void (APIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i);
+typedef void (APIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (APIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer);
+typedef void (APIENTRY * PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params);
+typedef void (APIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+
+/* ARB_multitexture */
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);
+typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum target);
+
+/* EXT_compiled_vertex_array */
+typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
+typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);
+
+/* EXT_cull_vertex */
+typedef void (APIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble* params);
+typedef void (APIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat* params);
+
+/* WIN_swap_hint */
+typedef void (APIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+
+/* EXT_point_parameter */
+typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __glext_h_ */
+#endif /* NO_SDL_GLEXT */
--- a/test/configure.in	Thu Oct 25 04:35:42 2001 +0000
+++ b/test/configure.in	Thu Oct 25 05:37:32 2001 +0000
@@ -2,7 +2,7 @@
 AC_INIT(README)
 
 dnl Setup for automake
-SDL_VERSION=1.2.0
+SDL_VERSION=1.2.3
 
 dnl Detect the canonical host and target build environment
 AC_CANONICAL_HOST
--- a/test/testgl.c	Thu Oct 25 04:35:42 2001 +0000
+++ b/test/testgl.c	Thu Oct 25 05:37:32 2001 +0000
@@ -6,13 +6,7 @@
 #include "SDL.h"
 
 #ifdef HAVE_OPENGL
-#ifdef WIN32
-#include <windows.h>
-#endif
-#if defined(__APPLE__) && defined(__MACH__)
-#include <OpenGL/gl.h>
-#else
-#include <GL/gl.h>
+#include "SDL_opengl.h"
 #endif
 
 #define SHADED_CUBE