1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code.  If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code.  If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 /*
29 ** QGL.H
30 */
31 
32 #ifndef __QGL_H__
33 #define __QGL_H__
34 
35 #if defined( ID_DEDICATED ) && defined( _WIN32 )
36 // to allow stubbing gl on windows, define WINGDIAPI to nothing - it would otherwise be
37 // extended to __declspec(dllimport) on MSVC (our stub is no dll.)
38 	#ifdef WINGDIAPI
39 		#pragma push_macro("WINGDIAPI")
40 		#undef WINGDIAPI
41 		#define WINGDIAPI
42 	#endif
43 #endif
44 
45 #include <SDL_opengl.h>
46 
47 #if defined( ID_DEDICATED ) && defined( _WIN32 )
48 // restore WINGDIAPI
49 	#ifdef WINGDIAPI
50 		#pragma pop_macro("WINGDIAPI")
51 	#endif
52 #endif
53 
54 typedef void (*GLExtension_t)(void);
55 
56 #ifdef __cplusplus
57 	extern "C" {
58 #endif
59 
60 GLExtension_t GLimp_ExtensionPointer( const char *name );
61 
62 #ifdef __cplusplus
63 	}
64 #endif
65 
66 // declare qgl functions
67 #define QGLPROC(name, rettype, args) extern rettype (APIENTRYP q##name) args;
68 #include "renderer/qgl_proc.h"
69 
70 // multitexture
71 extern	void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
72 extern	void ( APIENTRY * qglMultiTexCoord2fvARB )( GLenum texture, GLfloat *st );
73 extern	void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
74 extern	void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
75 
76 // ARB_vertex_buffer_object
77 extern PFNGLBINDBUFFERARBPROC qglBindBufferARB;
78 extern PFNGLDELETEBUFFERSARBPROC qglDeleteBuffersARB;
79 extern PFNGLGENBUFFERSARBPROC qglGenBuffersARB;
80 extern PFNGLISBUFFERARBPROC qglIsBufferARB;
81 extern PFNGLBUFFERDATAARBPROC qglBufferDataARB;
82 extern PFNGLBUFFERSUBDATAARBPROC qglBufferSubDataARB;
83 extern PFNGLGETBUFFERSUBDATAARBPROC qglGetBufferSubDataARB;
84 extern PFNGLMAPBUFFERARBPROC qglMapBufferARB;
85 extern PFNGLUNMAPBUFFERARBPROC qglUnmapBufferARB;
86 extern PFNGLGETBUFFERPARAMETERIVARBPROC qglGetBufferParameterivARB;
87 extern PFNGLGETBUFFERPOINTERVARBPROC qglGetBufferPointervARB;
88 
89 // 3D textures
90 extern void ( APIENTRY *qglTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
91 
92 // shared texture palette
93 extern	void ( APIENTRY *qglColorTableEXT)( int, int, int, int, int, const void * );
94 
95 // EXT_stencil_two_side
96 extern	PFNGLACTIVESTENCILFACEEXTPROC	qglActiveStencilFaceEXT;
97 
98 // DG: couldn't find any extension for this, it's supported in GL2.0 and newer, incl OpenGL ES2.0
99 extern PFNGLSTENCILOPSEPARATEPROC qglStencilOpSeparate;
100 
101 // ARB_texture_compression
102 extern	PFNGLCOMPRESSEDTEXIMAGE2DARBPROC	qglCompressedTexImage2DARB;
103 extern	PFNGLGETCOMPRESSEDTEXIMAGEARBPROC	qglGetCompressedTexImageARB;
104 
105 // ARB_vertex_program / ARB_fragment_program
106 extern PFNGLVERTEXATTRIBPOINTERARBPROC		qglVertexAttribPointerARB;
107 extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC	qglEnableVertexAttribArrayARB;
108 extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC	qglDisableVertexAttribArrayARB;
109 extern PFNGLPROGRAMSTRINGARBPROC			qglProgramStringARB;
110 extern PFNGLBINDPROGRAMARBPROC				qglBindProgramARB;
111 extern PFNGLGENPROGRAMSARBPROC				qglGenProgramsARB;
112 extern PFNGLPROGRAMENVPARAMETER4FVARBPROC	qglProgramEnvParameter4fvARB;
113 extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC	qglProgramLocalParameter4fvARB;
114 
115 // GL_EXT_depth_bounds_test
116 extern PFNGLDEPTHBOUNDSEXTPROC              qglDepthBoundsEXT;
117 
118 #if defined( _WIN32 ) && defined(ID_ALLOW_TOOLS)
119 
120 extern  int   (WINAPI * qwglChoosePixelFormat)(HDC, CONST PIXELFORMATDESCRIPTOR *);
121 extern  int   (WINAPI * qwglDescribePixelFormat) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
122 extern  int   (WINAPI * qwglGetPixelFormat)(HDC);
123 extern  BOOL(WINAPI * qwglSetPixelFormat)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
124 extern  BOOL(WINAPI * qwglSwapBuffers)(HDC);
125 
126 extern BOOL(WINAPI * qwglCopyContext)(HGLRC, HGLRC, UINT);
127 extern HGLRC(WINAPI * qwglCreateContext)(HDC);
128 extern HGLRC(WINAPI * qwglCreateLayerContext)(HDC, int);
129 extern BOOL(WINAPI * qwglDeleteContext)(HGLRC);
130 extern HGLRC(WINAPI * qwglGetCurrentContext)(VOID);
131 extern HDC(WINAPI * qwglGetCurrentDC)(VOID);
132 extern PROC(WINAPI * qwglGetProcAddress)(LPCSTR);
133 extern BOOL(WINAPI * qwglMakeCurrent)(HDC, HGLRC);
134 extern BOOL(WINAPI * qwglShareLists)(HGLRC, HGLRC);
135 extern BOOL(WINAPI * qwglUseFontBitmaps)(HDC, DWORD, DWORD, DWORD);
136 
137 extern BOOL(WINAPI * qwglUseFontOutlines)(HDC, DWORD, DWORD, DWORD, FLOAT,
138 	FLOAT, int, LPGLYPHMETRICSFLOAT);
139 
140 extern BOOL(WINAPI * qwglDescribeLayerPlane)(HDC, int, int, UINT,
141 	LPLAYERPLANEDESCRIPTOR);
142 extern int  (WINAPI * qwglSetLayerPaletteEntries)(HDC, int, int, int,
143 	CONST COLORREF *);
144 extern int  (WINAPI * qwglGetLayerPaletteEntries)(HDC, int, int, int,
145 	COLORREF *);
146 extern BOOL(WINAPI * qwglRealizeLayerPalette)(HDC, int, BOOL);
147 extern BOOL(WINAPI * qwglSwapLayerBuffers)(HDC, UINT);
148 
149 #endif	// _WIN32 && ID_ALLOW_TOOLS
150 
151 #endif
152