ScummVM API documentation
system_headers.h
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 modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (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, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef GRAPHICS_OPENGL_SYSTEM_HEADERS_H
23
#define GRAPHICS_OPENGL_SYSTEM_HEADERS_H
24
25
#include "common/scummsys.h"
26
27
// On macOS we only support GL contexts. The reason is that Apple's GL interface
28
// uses "void *" for GLhandleARB which is not type compatible with GLint. This
29
// kills our aliasing trick for extension functions and thus would force us to
30
// supply two different Shader class implementations or introduce other
31
// wrappers. macOS only supports GL contexts right now anyway (at least
32
// according to SDL2 sources), thus it is not much of an issue.
33
#if defined(MACOSX) && (!defined(USE_GLES_MODE) || USE_GLES_MODE != 0)
34
//#warning "Only forced OpenGL mode is supported on macOS. Overriding settings."
35
#undef USE_GLES_MODE
36
#define USE_GLES_MODE 0
37
#endif
38
39
// We allow to force GL or GLES modes on compile time.
40
// For this the USE_GLES_MODE define is used. The following values represent
41
// the given selection choices:
42
// 0 - Force OpenGL context
43
// 1 - Force OpenGL ES context
44
// 2 - Force OpenGL ES 2.0 context
45
#ifdef USE_GLES_MODE
46
#define USE_FORCED_GL (USE_GLES_MODE == 0)
47
#define USE_FORCED_GLES (USE_GLES_MODE == 1)
48
#define USE_FORCED_GLES2 (USE_GLES_MODE == 2)
49
#else
50
#define USE_FORCED_GL 0
51
#define USE_FORCED_GLES 0
52
#define USE_FORCED_GLES2 0
53
#endif
54
55
// Don't include any OpenGL stuff if we didn't enable it
56
#ifdef USE_OPENGL
57
#ifdef USE_GLAD
58
59
#include "graphics/opengl/glad.h"
60
61
#elif USE_FORCED_GLES2
62
63
#define GL_GLEXT_PROTOTYPES
64
#if defined(IPHONE)
65
#include <OpenGLES/ES2/gl.h>
66
#include <OpenGLES/ES2/glext.h>
67
#else
68
#include <GLES2/gl2.h>
69
#include <GLES2/gl2ext.h>
70
#endif
71
#undef GL_GLEXT_PROTOTYPES
72
73
#elif USE_FORCED_GLES
74
75
#define GL_GLEXT_PROTOTYPES
76
#if defined(IPHONE)
77
#include <OpenGLES/ES1/gl.h>
78
#include <OpenGLES/ES1/glext.h>
79
#else
80
#include <GLES/gl.h>
81
#include <GLES/glext.h>
82
#endif
83
#undef GL_GLEXT_PROTOTYPES
84
85
#else
86
87
#define GL_GLEXT_PROTOTYPES
88
#include <GL/gl.h>
89
#include <GL/glext.h>
90
#undef GL_GLEXT_PROTOTYPES
91
92
#endif
93
#endif
94
95
#if !defined(GL_TEXTURE_MAX_LEVEL) && defined(GL_TEXTURE_MAX_LEVEL_APPLE)
96
#define GL_TEXTURE_MAX_LEVEL GL_TEXTURE_MAX_LEVEL_APPLE
97
#endif
98
99
#if !defined(GL_BGRA) && defined(GL_BGRA_EXT)
100
#define GL_BGRA GL_BGRA_EXT
101
#endif
102
103
#if !defined(GL_UNPACK_ROW_LENGTH)
104
// The Android SDK does not declare GL_UNPACK_ROW_LENGTH_EXT
105
#define GL_UNPACK_ROW_LENGTH 0x0CF2
106
#endif
107
108
#if !defined(GL_MAX_SAMPLES)
109
// The Android SDK and SDL1 don't declare GL_MAX_SAMPLES
110
#define GL_MAX_SAMPLES 0x8D57
111
#endif
112
113
#if !defined(GL_STACK_OVERFLOW)
114
#define GL_STACK_OVERFLOW 0x0503
115
#endif
116
117
#if !defined(GL_STACK_UNDERFLOW)
118
#define GL_STACK_UNDERFLOW 0x0504
119
#endif
120
121
#if !defined(GL_CLAMP_TO_BORDER)
122
#define GL_CLAMP_TO_BORDER 0x812D
123
#endif
124
125
#if !defined(GL_MIRRORED_REPEAT)
126
#define GL_MIRRORED_REPEAT 0x8370
127
#endif
128
129
#if !defined(GL_DRAW_FRAMEBUFFER_BINDING)
130
#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
131
#endif
132
133
#if !defined(GL_DEPTH_COMPONENT24)
134
// For GLES2 with GL_OES_depth24
135
#define GL_DEPTH_COMPONENT24 0x81A6
136
#endif
137
138
#if !defined(GL_DEPTH_STENCIL)
139
// For GLES2 with GL_OES_packed_depth_stencil
140
#define GL_DEPTH_STENCIL 0x84F9
141
#endif
142
143
#if !defined(GL_DEPTH24_STENCIL8)
144
// For GLES2 with GL_OES_packed_depth_stencil
145
#define GL_DEPTH24_STENCIL8 0x88F0
146
#endif
147
148
#if !defined(GL_DEPTH_STENCIL_ATTACHMENT)
149
// For WebGL: see https://github.com/emscripten-core/emscripten/issues/4832
150
#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
151
#endif
152
153
#endif
graphics
opengl
system_headers.h
Generated on Wed Sep 3 2025 09:17:32 for ScummVM API documentation by
1.8.13