-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglUE.h
231 lines (199 loc) · 10.7 KB
/
glUE.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
//////////////////////////////////////////////////////////////////////
// ________ ____ ___
// | \ / | / /
// +---+ \/ |/ /
// +--+| |\ /| <
// | || | \ / | |\ \
// | | \/ | | \ \
// \_____| |__| \__\
// Copyright 2001
// Joe Michael Kniss
// <<<jmk@cs.utah.edu>>>
// "All Your Base are Belong to Us"
//
// GL Utills and Extensions v0.01(beta)
//
// glUE.h: interface for the glUE class.
// The purpose of the "class" is to provide access to extensions
// without having to go through the hassle of aquiring them
// in various places. They are defined as "extern" so that a
// single function pointer is kept around, ie. this file can
// be included in multiple files. The "glue" class should be
// created right after the gl window is created.
//
// NOTE: Many of the extensions defined by this header will require
// "exparamental" drivers from the chip/card manufacurer. If an
// extension that you want is not detected, this is probably why.
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_GLUE_H__F345B9AF_7BCA_4BAB_BC9E_949B280622AE__INCLUDED_)
#define AFX_GLUE_H__F345B9AF_7BCA_4BAB_BC9E_949B280622AE__INCLUDED_
//---------------------- Sort of lame card select --------------
// This is being phased out, do not use it
#define WILDCAT 0
#define RADEON 0
#define R200 0
#define GEFORCE3 0
#define GEFORCE2 0
//--------------------------------------------------------------
#ifdef WIN32
#include <windows.h> // must be included before any OpenGL
#endif
#include <GL/glut.h> // glut includes gl.h
//#include <GL/gl.h>
#include <GL/glu.h>
#ifdef WIN32
//------- This include file is nVidia specific!!!-----------
#include <GL/glExt.h>
//------- This include file is windows specific!!!----------
#include <GL/wglext.h>
//------ This include file is ATI specific!!! --------------
#include <GL/glATI.h>
#include <GL/wglATI.h>
//==================================================================================
//------------------ Extension Definitions -----------------------------------------
//==================================================================================
// NOTE: To quickly test if an extension is available, simply test if the function
// pointer is non zero. ie:
// if(<functionName>){ ...<functionName>(..); ...} else { ... do something else}
//
//
//------------------ 3d texture ----------------------------------------------------
typedef void (APIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level,
GLint internalformat,
GLsizei width, GLsizei height,
GLsizei depth, GLint border,
GLenum format, GLenum type,
const GLvoid *pixels);
extern PFNGLTEXIMAGE3DPROC glTexImage3DEXT;
#ifdef GL_EXT_blend_minmax
extern PFNGLBLENDEQUATIONEXTPROC glBlendEquationEXT;
#endif
//------------------ Palated texture -----------------------------------------------
#ifdef GL_EXT_color_table
typedef void (APIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target,
GLenum internalformat,
GLsizei width,
GLenum format,
GLenum type,
const GLvoid *table);
extern PFNGLCOLORTABLEEXTPROC glColorTableEXT;
#endif // end palated texture
//------------------ Multi-texture -------------------------------------------------
#ifdef GL_ARB_multitexture
extern PFNGLACTIVETEXTUREARBPROC glActiveTexture;
extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTexture;
extern PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB;
extern PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB;
extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
extern PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB;
extern PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB;
extern PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB;
#endif //end multi texture
//----------------- Secondary color ------------------------------------------------
#ifdef GL_EXT_secondary_color
extern PFNGLSECONDARYCOLOR3FEXTPROC glSecondaryColor3fEXT;
#endif
//------------------ nVidia Stuff ------------------------------------------------
//------------------ Register Combiners --------------------------------------------
#ifdef GL_NV_register_combiners
extern PFNGLCOMBINERPARAMETERFVNVPROC glCombinerParameterfvNV;
extern PFNGLCOMBINERPARAMETERFNVPROC glCombinerParameterfNV;
extern PFNGLCOMBINERPARAMETERIVNVPROC glCombinerParameterivNV;
extern PFNGLCOMBINERPARAMETERINVPROC glCombinerParameteriNV;
extern PFNGLCOMBINERINPUTNVPROC glCombinerInputNV;
extern PFNGLCOMBINEROUTPUTNVPROC glCombinerOutputNV;
extern PFNGLFINALCOMBINERINPUTNVPROC glFinalCombinerInputNV;
extern PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC glGetCombinerInputParameterfvNV;
extern PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC glGetCombinerInputParameterivNV;
extern PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC glGetCombinerOutputParameterfvNV;
extern PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC glGetCombinerOutputParameterivNV;
extern PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC glGetFinalCombinerInputParameterfvNV;
extern PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC glGetFinalCombinerInputParameterivNV;
#endif
//------------------ ATI Stuff ------------------------------------------------
//------------------ env-bump map/ pixel texture -----------------------------------
// NOTE: This extension is only for ATI Radions, it can be used to achieve
// pixel texture as well as reflective bump mapping
// but, fragment shaders are the bomb!!
#ifdef GL_ATIX_envmap_bumpmap
extern PFNGLTEXBUMPPARAMETERIVATIXPROC glTexBumpParameterivATIX;
extern PFNGLTEXBUMPPARAMETERFVATIXPROC glTexBumpParameterfvATIX;
extern PFNGLGETTEXBUMPPARAMETERIVATIXPROC glGetTexBumpParameterivATIX;
extern PFNGLGETTEXBUMPPARAMETERFVATIXPROC glGetTexBumpParameterfvATIX;
#endif //end EMBM
#ifdef GL_ATI_fragment_shader
extern PFNGLGENFRAGMENTSHADERSATIPROC glGenFragmentShadersATI;
extern PFNGLBINDFRAGMENTSHADERATIPROC glBindFragmentShaderATI;
extern PFNGLDELETEFRAGMENTSHADERATIPROC glDeleteFragmentShaderATI;
extern PFNGLBEGINFRAGMENTSHADERATIPROC glBeginFragmentShaderATI;
extern PFNGLENDFRAGMENTSHADERATIPROC glEndFragmentShaderATI;
extern PFNGLPASSTEXCOORDATIPROC glPassTexCoordATI;
extern PFNGLSAMPLEMAPATIPROC glSampleMapATI;
extern PFNGLCOLORFRAGMENTOP1ATIPROC glColorFragmentOp1ATI;
extern PFNGLCOLORFRAGMENTOP2ATIPROC glColorFragmentOp2ATI;
extern PFNGLCOLORFRAGMENTOP3ATIPROC glColorFragmentOp3ATI;
extern PFNGLALPHAFRAGMENTOP1ATIPROC glAlphaFragmentOp1ATI;
extern PFNGLALPHAFRAGMENTOP2ATIPROC glAlphaFragmentOp2ATI;
extern PFNGLALPHAFRAGMENTOP3ATIPROC glAlphaFragmentOp3ATI;
extern PFNGLSETFRAGMENTSHADERCONSTANTATIPROC glSetFragmentShaderConstantATI;
#endif
//------------------ WGL Extensions ------------------------------------------------
#ifdef WGL_ARB_pbuffer
extern PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB;
extern PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB;
extern PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB;
extern PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB;
extern PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB;
#endif
#ifdef WGL_ARB_pixel_format
extern PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB;
extern PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB;
extern PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
#endif
#ifdef WGL_ARB_render_texture //render to texture
extern PFNWGLBINDTEXIMAGEARBPROC wglBindTexImageARB;
extern PFNWGLRELEASETEXIMAGEARBPROC wglReleaseTexImageARB;
extern PFNWGLSETPBUFFERATTRIBARBPROC wglSetBufferAttribARB;
#endif
#endif // #ifdef WIN32
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
//------------------ Capture and Report gl Errors ----------------------------------
// NOTE: the calling convention for GLErr is:
// location = "Classname.function()" to identify where you made the call
// glfuncname = "Name" of the gl Function which you are testing for errors
// Returns 0 if no error, 1 if there was an error.
int GlErr(char *location, char *glfuncname);
//------------------ Query extensions ----------------------------------------------
// Returns true (!=0) if the extension defined by the extName string is available for
// the card. If the extName string == "Print" all of the extensions available on the
// card are printed to standard out.
GLboolean QueryExtension(char *extName);
//------------------ Load all Extensions -------------------------------------------
// Attempts to load all of the extensions for the defined card flag
// Needs to be adapted for LINUX !!!
#ifdef WIN32
void LoadAllExtensions();
//----- get individual sets of extensions
void getOGL12();
void getNV20();
void getATI8K();
void getWGL();
#endif
//------------------ Card Profile --------------------------------------------------
// Figure out what card we are using, by checking for unique extensions
//
// returns an integer from the gluvv.plat enum (gluvvPlatform)
int CardProfile();
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
#endif // !defined(AFX_GLUE_H__F345B9AF_7BCA_4BAB_BC9E_949B280622AE__INCLUDED_)