Halide 17.0.1
Halide compiler and libraries
Loading...
Searching...
No Matches
mini_opengl.h
Go to the documentation of this file.
1#ifndef MINI_OPENGL_H
2#define MINI_OPENGL_H
3
4// ---------- OpenGL core (1.3 and earlier) ----------
5
6typedef char GLchar;
7typedef unsigned char GLubyte;
8typedef unsigned int GLenum;
9typedef unsigned char GLboolean;
10typedef int GLint;
11typedef unsigned int GLuint;
12typedef int GLsizei;
14typedef float GLfloat;
15typedef double GLdouble;
16typedef void GLvoid;
17
18#define GL_NO_ERROR 0x0
19#define GL_FALSE 0x0
20#define GL_TRUE 0x1
21#define GL_TRIANGLES 0x0004
22#define GL_TRIANGLE_STRIP 0x0005
23#define GL_CULL_FACE 0x0B44
24#define GL_DEPTH_TEST 0x0B71
25#define GL_VIEWPORT 0x0BA2
26#define GL_PACK_ALIGNMENT 0x0D05
27#define GL_UNPACK_ALIGNMENT 0x0CF5
28#define GL_UNPACK_ROW_LENGTH 0x0CF2
29#define GL_PACK_ROW_LENGTH 0x0D02
30#define GL_TEXTURE_2D 0x0DE1
31#define GL_TEXTURE_WIDTH 0x1000
32#define GL_TEXTURE_HEIGHT 0x1001
33#define GL_BYTE 0x1400
34#define GL_UNSIGNED_BYTE 0x1401
35#define GL_SHORT 0x1402
36#define GL_UNSIGNED_SHORT 0x1403
37#define GL_INT 0x1404
38#define GL_UNSIGNED_INT 0x1405
39#define GL_FLOAT 0x1406
40#define GL_MODELVIEW 0x1700
41#define GL_PROJECTION 0x1701
42#define GL_RED 0x1903
43#define GL_RGB 0x1907
44#define GL_RGBA 0x1908
45#define GL_LUMINANCE 0x1909
46#define GL_LUMINANCE_ALPHA 0x190A
47#define GL_VERSION 0x1F02
48#define GL_EXTENSIONS 0x1F03
49#define GL_NEAREST 0x2600
50#define GL_TEXTURE_MAG_FILTER 0x2800
51#define GL_TEXTURE_MIN_FILTER 0x2801
52#define GL_TEXTURE_WRAP_S 0x2802
53#define GL_TEXTURE_WRAP_T 0x2803
54#define GL_CLAMP_TO_EDGE 0x812F
55#define GL_TEXTURE0 0x84C0
56#define GL_TEXTURE1 0x84C1
57#define GL_TEXTURE2 0x84C2
58#define GL_TEXTURE3 0x84C3
59#define GL_ACTIVE_TEXTURE 0x84E0
60#define GL_TEXTURE_BINDING_2D 0x8069
61#define GL_ACTIVE_UNIFORMS 0x8B86
62
63typedef void (*PFNGLACTIVETEXTUREPROC)(GLenum texture);
64typedef void (*PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture);
65typedef void (*PFNGLDISABLEPROC)(GLenum cap);
66typedef void (*PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures);
67typedef void (*PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs);
68typedef void (*PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
69typedef void (*PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures);
71typedef const GLubyte *(*PFNGLGETSTRINGPROC)(GLenum name);
72typedef void (*PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level,
73 GLenum format, GLenum type,
74 GLvoid *pixels);
75typedef void (*PFNGLLOADIDENTITYPROC)();
76typedef void (*PFNGLMATRIXMODEPROC)(GLenum mode);
77typedef void (*PFNGLORTHOPROC)(GLdouble left, GLdouble right,
78 GLdouble bottom, GLdouble top,
79 GLdouble near_val, GLdouble far_val);
80typedef void (*PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param);
81
82typedef void (*PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level,
83 GLenum pname, GLint *params);
84typedef void (*PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level,
85 GLint internalFormat,
86 GLsizei width, GLsizei height,
87 GLint border, GLenum format, GLenum type,
88 const GLvoid *pixels);
89typedef void (*PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param);
90typedef void (*PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level,
91 GLint xoffset, GLint yoffset,
92 GLsizei width, GLsizei height,
93 GLenum format, GLenum type,
94 const GLvoid *data);
95typedef void (*PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
96typedef void (*PFNGLREADPIXELS)(GLint x, GLint y,
97 GLsizei width, GLsizei height,
98 GLenum format, GLenum type,
99 GLvoid *pixels);
100
101// ---------- OpenGL 1.5 ----------
102
103#define GL_ARRAY_BUFFER 0x8892
104#define GL_ELEMENT_ARRAY_BUFFER 0x8893
105#define GL_STATIC_DRAW 0x88E4
106#define GL_ARRAY_BUFFER_BINDING 0x8894
107#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
108
109typedef void (*PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers);
110typedef void (*PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers);
111typedef void (*PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer);
112typedef void (*PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
113
114// ---------- OpenGL 2.0 ----------
115
116#define GL_FRAGMENT_SHADER 0x8B30
117#define GL_VERTEX_SHADER 0x8B31
118#define GL_COMPILE_STATUS 0x8B81
119#define GL_LINK_STATUS 0x8B82
120#define GL_INFO_LOG_LENGTH 0x8B84
121#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
122#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
123#define GL_CURRENT_PROGRAM 0x8B8D
124#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
125#define GL_MAX_VERTEX_ATTRIBS 0x8869
126#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
127
128typedef void (*PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader);
129typedef void (*PFNGLCOMPILESHADERPROC)(GLuint shader);
132typedef void (*PFNGLDELETEPROGRAMPROC)(GLuint program);
133typedef void (*PFNGLDELETESHADERPROC)(GLuint shader);
136typedef GLint (*PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name);
137typedef void (*PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params);
138typedef void (*PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
139typedef void (*PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params);
140typedef void (*PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
141typedef GLint (*PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name);
142typedef void (*PFNGLLINKPROGRAMPROC)(GLuint program);
143typedef void (*PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
144typedef void (*PFNGLUNIFORM1FPROC)(GLuint location, GLfloat value);
145typedef void (*PFNGLUNIFORM1IPROC)(GLuint location, GLint value);
146typedef void (*PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value);
147typedef void (*PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value);
148typedef void (*PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value);
149typedef void (*PFNGLUSEPROGRAMPROC)(GLuint program);
150typedef void (*PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
151typedef void (*PFNGLGETINTEGERV)(GLenum pname, GLint *data);
152typedef void (*PFNGLGETBOOLEANV)(GLenum pname, GLboolean *data);
153typedef void (*PFNGLFINISHPROC)();
154typedef void (*PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params);
155
156// ---------- OpenGL 3.0 ----------
157
158#define GL_MAJOR_VERSION 0x821B
159#define GL_MINOR_VERSION 0x821C
160#define GL_NUM_EXTENSIONS 0x821D
161#define GL_RG 0x8227
162#define GL_R32F 0x822E
163#define GL_RG32F 0x8230
164#define GL_RGBA32F 0x8814
165#define GL_RGB32F 0x8815
166#define GL_LUMINANCE32F 0x8818
167#define GL_VERTEX_ARRAY_BINDING 0x85B5
168
169// GL_ARB_framebuffer_object
170#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
171#define GL_COLOR_ATTACHMENT0 0x8CE0
172#define GL_FRAMEBUFFER 0x8D40
173#define GL_FRAMEBUFFER_BINDING 0x8CA6
174
175typedef void (*PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer);
177typedef void (*PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers);
178typedef void (*PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
179typedef void (*PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers);
180
181typedef void (*PFNGLGENVERTEXARRAYS)(GLsizei n, GLuint *arrays);
182typedef void (*PFNGLBINDVERTEXARRAY)(GLuint array);
183typedef void (*PFNGLDELETEVERTEXARRAYS)(GLsizei n, const GLuint *arrays);
184typedef const GLubyte *(*PFNGLGETSTRINGI)(GLenum name, GLuint index);
185typedef void (*PFNDRAWBUFFERS)(GLsizei n, const GLenum *bufs);
186
187// ---------- OpenGL ES 3.1 ----------
188
189#define GL_TEXTURE_BUFFER_EXT 0x8c2a
190
191#define GL_COMPUTE_SHADER 0x91B9
192#define GL_DYNAMIC_COPY 0x88ea
193
194#define GL_READ_ONLY 0x88B8
195#define GL_WRITE_ONLY 0x88B9
196
197#define GL_MAP_READ_BIT 0x0001
198#define GL_MAP_WRITE_BIT 0x0002
199
200#define GL_SHADER_STORAGE_BUFFER 0x90D2
201
202#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
203#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
204#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
205
206typedef unsigned int GLbitfield;
208
209typedef void (*PFNGLTEXBUFFEREXTPROC)(GLenum target, GLenum internalformat, GLuint buffer);
210typedef void (*PFNGLBINDIMAGETEXTUREPROC)(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
211typedef void (*PFNGLMEMORYBARRIERPROC)(GLbitfield barriers);
212typedef void *(*PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
213typedef void (*PFNGLDISPATCHCOMPUTEPROC)(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
214typedef void (*PFNGLUNMAPBUFFERPROC)(GLenum target);
215typedef void (*PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer);
216typedef void (*PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers);
217
218typedef void (*PFNGLGETACTIVEUNIFORM)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
219typedef GLint (*PFNGLGETUNIFORMLOCATION)(GLuint program, const GLchar *name);
220
221#endif // MINI_OPENGL_H
ptrdiff_t GLintptr
void(* PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer)
unsigned char GLubyte
Definition mini_opengl.h:7
void(* PFNGLUNMAPBUFFERPROC)(GLenum target)
void(* PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
void(* PFNGLGENVERTEXARRAYS)(GLsizei n, GLuint *arrays)
void(* PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param)
Definition mini_opengl.h:80
unsigned int GLbitfield
void(* PFNGLBINDIMAGETEXTUREPROC)(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
void(* PFNGLUNIFORM1IPROC)(GLuint location, GLint value)
void(* PFNGLDISABLEPROC)(GLenum cap)
Definition mini_opengl.h:65
void(* PFNGLGETACTIVEUNIFORM)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
void(* PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params)
void GLvoid
Definition mini_opengl.h:16
void(* PFNGLDELETEPROGRAMPROC)(GLuint program)
void(* PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures)
Definition mini_opengl.h:66
void(* PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers)
GLint(* PFNGLGETUNIFORMLOCATION)(GLuint program, const GLchar *name)
void(* PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value)
float GLfloat
Definition mini_opengl.h:14
void(* PFNGLMATRIXMODEPROC)(GLenum mode)
Definition mini_opengl.h:76
GLint(* PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name)
void(* PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
Definition mini_opengl.h:84
void(* PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
void(* PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar **string, const GLint *length)
double GLdouble
Definition mini_opengl.h:15
void(* PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *data)
Definition mini_opengl.h:90
void(* PFNGLDELETESHADERPROC)(GLuint shader)
void(* PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs)
Definition mini_opengl.h:67
void(* PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
void(* PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param)
Definition mini_opengl.h:89
void(* PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers)
int GLint
Definition mini_opengl.h:10
GLuint(* PFNGLCREATESHADERPROC)(GLenum type)
void(* PFNGLLOADIDENTITYPROC)()
Definition mini_opengl.h:75
void(* PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures)
Definition mini_opengl.h:69
void(* PFNGLDISPATCHCOMPUTEPROC)(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
void(* PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
Definition mini_opengl.h:72
void(* PFNGLGETBOOLEANV)(GLenum pname, GLboolean *data)
void(* PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer)
GLenum(* PFNGLGETERRORPROC)()
Definition mini_opengl.h:70
void(* PFNDRAWBUFFERS)(GLsizei n, const GLenum *bufs)
void(* PFNGLDELETEVERTEXARRAYS)(GLsizei n, const GLuint *arrays)
void(* PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params)
void(* PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers)
unsigned int GLenum
Definition mini_opengl.h:8
void(* PFNGLUNIFORM1FPROC)(GLuint location, GLfloat value)
void(* PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index)
void(* PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height)
Definition mini_opengl.h:95
void(* PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value)
void(* PFNGLLINKPROGRAMPROC)(GLuint program)
void(* PFNGLMEMORYBARRIERPROC)(GLbitfield barriers)
int GLsizei
Definition mini_opengl.h:12
void(* PFNGLACTIVETEXTUREPROC)(GLenum texture)
Definition mini_opengl.h:63
void(* PFNGLCOMPILESHADERPROC)(GLuint shader)
void(* PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value)
void(* PFNGLTEXBUFFEREXTPROC)(GLenum target, GLenum internalformat, GLuint buffer)
void(* PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params)
GLint(* PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name)
unsigned char GLboolean
Definition mini_opengl.h:9
unsigned int GLuint
Definition mini_opengl.h:11
ptrdiff_t GLsizeiptr
Definition mini_opengl.h:13
void(* PFNGLGETINTEGERV)(GLenum pname, GLint *data)
void(* PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params)
Definition mini_opengl.h:82
GLenum(* PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target)
void(* PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture)
Definition mini_opengl.h:64
void(* PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader)
void(* PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val)
Definition mini_opengl.h:77
void(* PFNGLBINDVERTEXARRAY)(GLuint array)
void(* PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
void(* PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index)
void(* PFNGLFINISHPROC)()
GLuint(* PFNGLCREATEPROGRAMPROC)()
void(* PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers)
void(* PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
Definition mini_opengl.h:68
void(* PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer)
void(* PFNGLUSEPROGRAMPROC)(GLuint program)
void(* PFNGLREADPIXELS)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
Definition mini_opengl.h:96
char GLchar
Definition mini_opengl.h:6
void(* PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
__PTRDIFF_TYPE__ ptrdiff_t