1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 /* This file is based on Mesa 3-D's gl.h and GLES/gl.h from Khronos Registry.
24  *
25  * Mesa 3-D's gl.h file is distributed under the following license:
26  * Mesa 3-D graphics library
27  *
28  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
29  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
30  *
31  * Permission is hereby granted, free of charge, to any person obtaining a
32  * copy of this software and associated documentation files (the "Software"),
33  * to deal in the Software without restriction, including without limitation
34  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
35  * and/or sell copies of the Software, and to permit persons to whom the
36  * Software is furnished to do so, subject to the following conditions:
37  *
38  * The above copyright notice and this permission notice shall be included
39  * in all copies or substantial portions of the Software.
40  *
41  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
42  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
44  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
45  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
46  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47  * OTHER DEALINGS IN THE SOFTWARE.
48  *
49  *
50  * GLES/gl.h from Khronos Registry is distributed under the following license:
51  * This document is licensed under the SGI Free Software B License Version
52  * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
53  */
54 
55 #ifndef BACKENDS_GRAPHICS_OPENGL_OPENGL_DEFS_H
56 #define BACKENDS_GRAPHICS_OPENGL_OPENGL_DEFS_H
57 
58 #include "common/scummsys.h"
59 
60 /*
61  * Datatypes
62  */
63 typedef uint   GLenum;
64 typedef uint8  GLboolean;
65 typedef uint   GLbitfield;
66 typedef void   GLvoid;
67 typedef int8   GLbyte;   /* 1-byte signed */
68 typedef int16  GLshort;  /* 2-byte signed */
69 typedef int32  GLint;    /* 4-byte signed */
70 typedef uint8  GLubyte;  /* 1-byte unsigned */
71 typedef uint16 GLushort; /* 2-byte unsigned */
72 typedef uint32 GLuint;   /* 4-byte unsigned */
73 typedef int32  GLsizei;  /* 4-byte signed */
74 typedef float  GLfloat;  /* single precision float */
75 typedef float  GLclampf; /* single precision float in [0,1] */
76 typedef double GLdouble; /* double precision float */
77 typedef double GLclampd; /* double precision float in [0,1] */
78 typedef char   GLchar;
79 #if defined(MACOSX)
80 typedef void  *GLhandleARB;
81 #else
82 typedef uint   GLhandleARB;
83 #endif
84 
85 // This is an addition from us to alias ARB shader object extensions to
86 // OpenGL (ES) 2.0 style functions. It only works when GLhandleARB and GLuint
87 // are type compatible.
88 typedef GLhandleARB GLprogram;
89 typedef GLhandleARB GLshader;
90 
91 /*
92  * Constants
93  */
94 
95 /* Boolean constants */
96 #define GL_FALSE                          0
97 #define GL_TRUE                           1
98 
99 /* StringName */
100 #define GL_VENDOR                         0x1F00
101 #define GL_RENDERER                       0x1F01
102 #define GL_VERSION                        0x1F02
103 #define GL_EXTENSIONS                     0x1F03
104 
105 /* ErrorCode */
106 #define GL_NO_ERROR                       0
107 #define GL_INVALID_ENUM                   0x0500
108 #define GL_INVALID_VALUE                  0x0501
109 #define GL_INVALID_OPERATION              0x0502
110 #define GL_STACK_OVERFLOW                 0x0503
111 #define GL_STACK_UNDERFLOW                0x0504
112 #define GL_OUT_OF_MEMORY                  0x0505
113 
114 /* ClearBufferMask */
115 #define GL_DEPTH_BUFFER_BIT               0x00000100
116 #define GL_STENCIL_BUFFER_BIT             0x00000400
117 #define GL_COLOR_BUFFER_BIT               0x00004000
118 
119 /* Scissor box */
120 #define GL_SCISSOR_BOX                    0x0C10
121 #define GL_SCISSOR_TEST                   0x0C11
122 
123 /* MatrixMode */
124 #define GL_MATRIX_MODE                    0x0BA0
125 #define GL_MODELVIEW                      0x1700
126 #define GL_PROJECTION                     0x1701
127 #define GL_TEXTURE                        0x1702
128 
129 /* EnableCap */
130 #define GL_FOG                            0x0B60
131 #define GL_LIGHTING                       0x0B50
132 #define GL_TEXTURE_2D                     0x0DE1
133 #define GL_CULL_FACE                      0x0B44
134 #define GL_ALPHA_TEST                     0x0BC0
135 #define GL_BLEND                          0x0BE2
136 #define GL_DITHER                         0x0BD0
137 #define GL_DEPTH_TEST                     0x0B71
138 #define GL_VERTEX_ARRAY                   0x8074
139 #define GL_COLOR_ARRAY                    0x8076
140 #define GL_TEXTURE_COORD_ARRAY            0x8078
141 
142 /* ShadingModel */
143 #define GL_FLAT                           0x1D00
144 #define GL_SMOOTH                         0x1D01
145 
146 /* HintMode */
147 #define GL_DONT_CARE                      0x1100
148 #define GL_FASTEST                        0x1101
149 #define GL_NICEST                         0x1102
150 
151 /* HintTarget */
152 #define GL_PERSPECTIVE_CORRECTION_HINT    0x0C50
153 #define GL_POINT_SMOOTH_HINT              0x0C51
154 #define GL_LINE_SMOOTH_HINT               0x0C52
155 #define GL_FOG_HINT                       0x0C54
156 #define GL_GENERATE_MIPMAP_HINT           0x8192
157 
158 /* BlendingFactorDest */
159 #define GL_ZERO                           0
160 #define GL_ONE                            1
161 #define GL_SRC_COLOR                      0x0300
162 #define GL_ONE_MINUS_SRC_COLOR            0x0301
163 #define GL_SRC_ALPHA                      0x0302
164 #define GL_ONE_MINUS_SRC_ALPHA            0x0303
165 #define GL_DST_ALPHA                      0x0304
166 #define GL_ONE_MINUS_DST_ALPHA            0x0305
167 
168 /* BlendingFactorSrc */
169 /*      GL_ZERO */
170 /*      GL_ONE */
171 #define GL_DST_COLOR                      0x0306
172 #define GL_ONE_MINUS_DST_COLOR            0x0307
173 #define GL_SRC_ALPHA_SATURATE             0x0308
174 /*      GL_SRC_ALPHA */
175 /*      GL_ONE_MINUS_SRC_ALPHA */
176 /*      GL_DST_ALPHA */
177 /*      GL_ONE_MINUS_DST_ALPHA */
178 
179 /* PixelFormat */
180 #define GL_ALPHA                          0x1906
181 #define GL_RGB                            0x1907
182 #define GL_RGBA                           0x1908
183 #define GL_BGR                            0x80E0
184 #define GL_BGRA                           0x80E1
185 
186 #define GL_RED                            0x1903
187 #define GL_R8                             0x8229
188 
189 /* PixelStoreParameter */
190 #define GL_UNPACK_ALIGNMENT               0x0CF5
191 #define GL_PACK_ALIGNMENT                 0x0D05
192 
193 /* DataType */
194 #define GL_BYTE                           0x1400
195 #define GL_UNSIGNED_BYTE                  0x1401
196 #define GL_SHORT                          0x1402
197 #define GL_UNSIGNED_SHORT                 0x1403
198 #define GL_FLOAT                          0x1406
199 #define GL_FIXED                          0x140C
200 
201 /* PixelType */
202 /*      GL_UNSIGNED_BYTE */
203 #define GL_UNSIGNED_SHORT_4_4_4_4         0x8033
204 #define GL_UNSIGNED_SHORT_5_5_5_1         0x8034
205 #define GL_UNSIGNED_SHORT_5_6_5           0x8363
206 
207 #define GL_UNSIGNED_SHORT_4_4_4_4_REV     0x8365
208 #define GL_UNSIGNED_SHORT_5_6_5_REV       0x8364
209 #define GL_UNSIGNED_SHORT_1_5_5_5_REV     0x8366
210 #define GL_UNSIGNED_INT_8_8_8_8           0x8035
211 #define GL_UNSIGNED_INT_8_8_8_8_REV       0x8367
212 
213 /* Implementation limits */
214 #define GL_MAX_TEXTURE_SIZE               0x0D33
215 
216 /* TextureMagFilter */
217 #define GL_NEAREST                        0x2600
218 #define GL_LINEAR                         0x2601
219 
220 /* TextureParameterName */
221 #define GL_TEXTURE_MAG_FILTER             0x2800
222 #define GL_TEXTURE_MIN_FILTER             0x2801
223 #define GL_TEXTURE_WRAP_S                 0x2802
224 #define GL_TEXTURE_WRAP_T                 0x2803
225 
226 /* TextureWrapMode */
227 #define GL_CLAMP                          0x2900
228 #define GL_REPEAT                         0x2901
229 #define GL_CLAMP_TO_EDGE                  0x812F
230 
231 /* BeginMode */
232 #define GL_POINTS                         0x0000
233 #define GL_LINES                          0x0001
234 #define GL_LINE_LOOP                      0x0002
235 #define GL_LINE_STRIP                     0x0003
236 #define GL_TRIANGLES                      0x0004
237 #define GL_TRIANGLE_STRIP                 0x0005
238 #define GL_TRIANGLE_FAN                   0x0006
239 
240 /* Shaders */
241 #define GL_FRAGMENT_SHADER                0x8B30
242 
243 #define GL_VERTEX_SHADER                  0x8B31
244 
245 /* Programs */
246 #define GL_COMPILE_STATUS                 0x8B81
247 #define GL_LINK_STATUS                    0x8B82
248 #define GL_INFO_LOG_LENGTH                0x8B84
249 #define GL_CURRENT_PROGRAM                0x8B8D
250 
251 /* Textures */
252 #define GL_TEXTURE0                       0x84C0
253 #define GL_TEXTURE1                       0x84C1
254 
255 /* GetPName */
256 #define GL_VIEWPORT                       0x0BA2
257 #define GL_FRAMEBUFFER_BINDING            0x8CA6
258 
259 /* Framebuffer objects */
260 #define GL_COLOR_ATTACHMENT0              0x8CE0
261 #define GL_FRAMEBUFFER                    0x8D40
262 
263 #endif
264