/
dropengl.h
184 lines (160 loc) · 5.6 KB
/
dropengl.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
/**\file
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2006 Jaakko Keränen <skyjake@dengine.net>
*\author Copyright © 2007 Daniel Swanson <danij@dengine.net>
*\author Copyright © 2006 Jamie Jones <yagisan@dengine.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/*
* drOpenGL.h: OpenGL Rasterizer for the Doomsday Engine
*/
#ifndef __DROPENGL_H__
#define __DROPENGL_H__
#ifdef WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <GL/gl.h>
# undef GL_ARB_multitexture
# undef GL_EXT_blend_minmax
# include <GL/glext.h>
# include <GL/glu.h>
# include <GL/wglext.h>
#endif
#ifdef UNIX
# define GL_GLEXT_PROTOTYPES
# ifdef MACOSX
# include <SDL/SDL.h>
# include <SDL/SDL_opengl.h>
# else
# include <SDL.h>
# include <SDL_opengl.h>
# endif
# define wglGetProcAddress SDL_GL_GetProcAddress
#endif
#include "atiext.h"
#include <string.h>
#include <doomsday.h>
#include <dglib.h>
#define USE_MULTITEXTURE 1
#define MAX_TEX_UNITS 2 // More won't be used.
#define DROGL_VERSION 230
#define DROGL_VERSION_TEXT "2.3."DOOMSDAY_RELEASE_NAME
#define DROGL_VERSION_FULL "DGL OpenGL Driver Version "DROGL_VERSION_TEXT" ("__DATE__")"
enum { VX, VY, VZ };
enum { CR, CG, CB, CA };
typedef enum arraytype_e {
AR_VERTEX,
AR_COLOR,
AR_TEXCOORD0,
AR_TEXCOORD1,
AR_TEXCOORD2,
AR_TEXCOORD3,
AR_TEXCOORD4,
AR_TEXCOORD5,
AR_TEXCOORD6,
AR_TEXCOORD7
} arraytype_t;
typedef struct rgba_s {
unsigned char color[4];
} rgba_t;
void initState(void);
//-------------------------------------------------------------------------
// main.c
//
extern int screenWidth, screenHeight;
extern int useFog, maxTexSize;
extern int palExtAvailable, sharedPalExtAvailable;
extern boolean allowCompression;
extern boolean noArrays;
extern int verbose;
extern int useAnisotropic;
extern int useVSync;
extern float maxAniso;
extern int maxTexUnits;
extern boolean wireframeMode;
void DG_Clear(int bufferbits);
void activeTexture(const GLenum texture);
//-------------------------------------------------------------------------
// draw.c
//
extern int polyCounter;
void InitArrays(void);
void CheckError(void);
void DG_Begin(int mode);
void DG_End(void);
void DG_Color3ub(DGLubyte r, DGLubyte g, DGLubyte b);
void DG_Color3ubv(DGLubyte * data);
void DG_Color4ub(DGLubyte r, DGLubyte g, DGLubyte b, DGLubyte a);
void DG_Color4ubv(DGLubyte * data);
void DG_Color3f(float r, float g, float b);
void DG_Color3fv(float *data);
void DG_Color4f(float r, float g, float b, float a);
void DG_Color4fv(float *data);
void DG_Vertex2f(float x, float y);
void DG_Vertex2fv(float *data);
void DG_Vertex3f(float x, float y, float z);
void DG_Vertex3fv(float *data);
void DG_TexCoord2f(float s, float t);
void DG_TexCoord2fv(float *data);
void DG_Vertices2ftv(int num, gl_ft2vertex_t * data);
void DG_Vertices3ftv(int num, gl_ft3vertex_t * data);
void DG_Vertices3fctv(int num, gl_fct3vertex_t * data);
void DG_DisableArrays(int vertices, int colors, int coords);
//-------------------------------------------------------------------------
// texture.c
//
extern rgba_t palette[256];
extern int usePalTex, dumpTextures, useCompr;
extern float grayMipmapFactor;
int DG_Power2(int num);
int enablePalTexExt(int enable);
DGLuint DG_NewTexture(void);
int DG_TexImage(int format, int width, int height, int mipmap,
void *data);
void DG_DeleteTextures(int num, DGLuint * names);
void DG_TexParameter(int pname, int param);
void DG_GetTexParameterv(int level, int pname, int *v);
void DG_Palette(int format, void *data);
int DG_Bind(DGLuint texture);
//-------------------------------------------------------------------------
// ext.c
//
#ifdef WIN32
extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
extern PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB;
extern PFNGLBLENDEQUATIONEXTPROC glBlendEquationEXT;
extern PFNGLLOCKARRAYSEXTPROC glLockArraysEXT;
extern PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;
extern PFNGLCOLORTABLEEXTPROC glColorTableEXT;
extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
#endif
extern int extMultiTex;
extern int extTexEnvComb;
extern int extNvTexEnvComb;
extern int extAtiTexEnvComb;
extern int extAniso;
extern int extVSync;
extern int extGenMip;
extern int extBlendSub;
extern int extS3TC;
void DG_InitExtensions(void);
#endif