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