gl.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. /*
  2. * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
  3. * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #ifndef GLAPI
  12. # define GLAPI extern
  13. #endif
  14. // OpenGL related `defines`
  15. #define GL_TRUE 1
  16. #define GL_FALSE 0
  17. // Matrix Modes
  18. #define GL_MODELVIEW 0x0050
  19. #define GL_PROJECTION 0x0051
  20. // glBegin/glEnd primitive types
  21. #define GL_TRIANGLES 0x0100
  22. #define GL_QUADS 0x0101
  23. #define GL_TRIANGLE_FAN 0x0102
  24. #define GL_TRIANGLE_STRIP 0x0103
  25. #define GL_POLYGON 0x0104
  26. // Depth buffer and alpha test compare functions
  27. #define GL_NEVER 0x0200
  28. #define GL_LESS 0x0201
  29. #define GL_EQUAL 0x0202
  30. #define GL_LEQUAL 0x0203
  31. #define GL_GREATER 0x0204
  32. #define GL_NOTEQUAL 0x0205
  33. #define GL_GEQUAL 0x0206
  34. #define GL_ALWAYS 0x0207
  35. // Buffer bits
  36. #define GL_COLOR_BUFFER_BIT 0x0200
  37. #define GL_DEPTH_BUFFER_BIT 0x0400
  38. // Enable capabilities
  39. #define GL_CULL_FACE 0x0B44
  40. #define GL_DEPTH_TEST 0x0B71
  41. // Alpha testing
  42. #define GL_ALPHA_TEST 0x0BC0
  43. #define GL_ALPHA_TEST_REF 0x0BC2
  44. #define GL_ALPHA_TEST_FUNC 0x0BC1
  45. // Alpha blending
  46. #define GL_BLEND 0x0BE2
  47. // Utility
  48. #define GL_VENDOR 0x1F00
  49. #define GL_RENDERER 0x1F01
  50. #define GL_VERSION 0x1F02
  51. // Blend factors
  52. #define GL_ZERO 0
  53. #define GL_ONE 1
  54. #define GL_SRC_COLOR 0x0300
  55. #define GL_ONE_MINUS_SRC_COLOR 0x0301
  56. #define GL_SRC_ALPHA 0x0302
  57. #define GL_ONE_MINUS_SRC_ALPHA 0x0303
  58. #define GL_DST_ALPHA 0x0304
  59. #define GL_ONE_MINUS_DST_ALPHA 0x0305
  60. #define GL_DST_COLOR 0x0306
  61. #define GL_ONE_MINUS_DST_COLOR 0x0307
  62. #define GL_SRC_ALPHA_SATURATE 0x0308
  63. // Sides
  64. #define GL_FRONT_LEFT 0x0400
  65. #define GL_FRONT_RIGHT 0x0401
  66. #define GL_BACK_LEFT 0x0402
  67. #define GL_BACK_RIGHT 0x0403
  68. #define GL_FRONT 0x0404
  69. #define GL_BACK 0x0405
  70. #define GL_LEFT 0x0406
  71. #define GL_RIGHT 0x0407
  72. #define GL_FRONT_AND_BACK 0x0408
  73. // Error codes
  74. #define GL_NO_ERROR 0
  75. #define GL_INVALID_ENUM 0x500
  76. #define GL_INVALID_VALUE 0x501
  77. #define GL_INVALID_OPERATION 0x502
  78. #define GL_STACK_OVERFLOW 0x0503
  79. #define GL_STACK_UNDERFLOW 0x0504
  80. #define GL_OUT_OF_MEMORY 0x505
  81. #define GL_INVALID_FRAMEBUFFER_OPERATION 0x506
  82. // Triangle winding order
  83. #define GL_CW 0x0900
  84. #define GL_CCW 0x0901
  85. // Hint enums
  86. #define GL_DONT_CARE 0x1100
  87. #define GL_FASTEST 0x1101
  88. #define GL_NICEST 0x1102
  89. #define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
  90. #define GL_POINT_SMOOTH_HINT 0x0C51
  91. #define GL_LINE_SMOOTH_HINT 0x0C52
  92. #define GL_POLYGON_SMOOTH_HINT 0x0C53
  93. #define GL_FOG_HINT 0x0C54
  94. #define GL_GENERATE_MIPMAP_HINT 0x8192
  95. #define GL_TEXTURE_COMPRESSION_HINT 0x84EF
  96. // Listing enums
  97. #define GL_COMPILE 0x1300
  98. #define GL_COMPILE_AND_EXECUTE 0x1301
  99. // Type enums
  100. #define GL_BYTE 0x1400
  101. #define GL_UNSIGNED_BYTE 0x1401
  102. #define GL_SHORT 0x1402
  103. #define GL_UNSIGNED_SHORT 0x1403
  104. #define GL_INT 0x1404
  105. #define GL_UNSIGNED_INT 0x1405
  106. #define GL_FLOAT 0x1406
  107. // Format enums
  108. #define GL_COLOR_INDEX 0x1900
  109. #define GL_LUMINANCE 0x1909
  110. #define GL_LUMINANCE_ALPHA 0x190A
  111. #define GL_BITMAP 0x1A00
  112. #define GL_STENCIL_INDEX 0x1901
  113. #define GL_DEPTH_COMPONENT 0x1902
  114. #define GL_RED 0x1903
  115. #define GL_GREEN 0x1904
  116. #define GL_BLUE 0x1905
  117. #define GL_ALPHA 0x1906
  118. #define GL_RGB 0x1907
  119. #define GL_RGBA 0x1908
  120. // Lighting related defines
  121. #define GL_FLAT 0x1D00
  122. #define GL_SMOOTH 0x1D01
  123. // More blend factors
  124. #define GL_CONSTANT_COLOR 0x8001
  125. #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
  126. #define GL_CONSTANT_ALPHA 0x8003
  127. #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
  128. // Pixel formats
  129. #define GL_RGB 0x1907
  130. #define GL_RGBA 0x1908
  131. #define GL_BGR 0x190B
  132. #define GL_BGRA 0x190C
  133. // Source pixel data format
  134. #define GL_UNSIGNED_BYTE 0x1401
  135. // Texture targets
  136. #define GL_TEXTURE_2D 0x0DE1
  137. // Texture Unit indices
  138. #define GL_TEXTURE0 0x84C0
  139. #define GL_TEXTURE1 0x84C1
  140. #define GL_TEXTURE2 0x84C2
  141. #define GL_TEXTURE3 0x84C3
  142. #define GL_TEXTURE4 0x84C4
  143. #define GL_TEXTURE5 0x84C5
  144. #define GL_TEXTURE6 0x84C6
  145. #define GL_TEXTURE7 0x84C7
  146. #define GL_TEXTURE8 0x84C8
  147. #define GL_TEXTURE9 0x84C9
  148. #define GL_TEXTURE10 0x84CA
  149. #define GL_TEXTURE11 0x84CB
  150. #define GL_TEXTURE12 0x84CC
  151. #define GL_TEXTURE13 0x84CD
  152. #define GL_TEXTURE14 0x84CE
  153. #define GL_TEXTURE15 0x84CF
  154. #define GL_TEXTURE16 0x84D0
  155. #define GL_TEXTURE17 0x84D1
  156. #define GL_TEXTURE18 0x84D2
  157. #define GL_TEXTURE19 0x84D3
  158. #define GL_TEXTURE20 0x84D4
  159. #define GL_TEXTURE21 0x84D5
  160. #define GL_TEXTURE22 0x84D6
  161. #define GL_TEXTURE23 0x84D7
  162. #define GL_TEXTURE24 0x84D8
  163. #define GL_TEXTURE25 0x84D9
  164. #define GL_TEXTURE26 0x84DA
  165. #define GL_TEXTURE27 0x84DB
  166. #define GL_TEXTURE28 0x84DC
  167. #define GL_TEXTURE29 0x84DD
  168. #define GL_TEXTURE30 0x84DE
  169. #define GL_TEXTURE31 0x84DF
  170. // Texture Environment and Parameters
  171. #define GL_NEAREST 0x2600
  172. #define GL_LINEAR 0x2601
  173. #define GL_NEAREST_MIPMAP_LINEAR 0x2602
  174. #define GL_REPEAT 0x2603
  175. // OpenGL State & GLGet
  176. #define GL_MODELVIEW_MATRIX 0x0BA6
  177. //
  178. // OpenGL typedefs
  179. //
  180. // Defines types used by all OpenGL applications
  181. // https://www.khronos.org/opengl/wiki/OpenGL_Type
  182. typedef char GLchar;
  183. typedef unsigned char GLuchar;
  184. typedef unsigned char GLubyte;
  185. typedef short GLshort;
  186. typedef unsigned short GLushort;
  187. typedef int GLint;
  188. typedef unsigned int GLuint;
  189. typedef int GLfixed;
  190. typedef long long GLint64;
  191. typedef unsigned long long GLuint64;
  192. typedef int GLsizei;
  193. typedef void GLvoid;
  194. typedef float GLfloat;
  195. typedef float GLclampf;
  196. typedef double GLdouble;
  197. typedef unsigned int GLenum;
  198. typedef unsigned int GLbitfield;
  199. GLAPI void glBegin(GLenum mode);
  200. GLAPI void glClear(GLbitfield mask);
  201. GLAPI void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  202. GLAPI void glClearDepth(GLdouble depth);
  203. GLAPI void glColor3f(GLfloat r, GLfloat g, GLfloat b);
  204. GLAPI void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
  205. GLAPI void glColor4fv(const GLfloat* v);
  206. GLAPI void glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
  207. GLAPI void glColor4ubv(const GLubyte* v);
  208. GLAPI void glDeleteTextures(GLsizei n, const GLuint* textures);
  209. GLAPI void glEnd();
  210. GLAPI void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal);
  211. GLAPI void glGenTextures(GLsizei n, GLuint* textures);
  212. GLAPI GLenum glGetError();
  213. GLAPI GLubyte* glGetString(GLenum name);
  214. GLAPI void glLoadIdentity();
  215. GLAPI void glLoadMatrixf(const GLfloat* matrix);
  216. GLAPI void glMatrixMode(GLenum mode);
  217. GLAPI void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal);
  218. GLAPI void glPushMatrix();
  219. GLAPI void glPopMatrix();
  220. GLAPI void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
  221. GLAPI void glScalef(GLfloat x, GLfloat y, GLfloat z);
  222. GLAPI void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
  223. GLAPI void glVertex2d(GLdouble x, GLdouble y);
  224. GLAPI void glVertex2dv(const GLdouble* v);
  225. GLAPI void glVertex2f(GLfloat x, GLfloat y);
  226. GLAPI void glVertex2fv(const GLfloat* v);
  227. GLAPI void glVertex2i(GLint x, GLint y);
  228. GLAPI void glVertex2iv(const GLint* v);
  229. GLAPI void glVertex2s(GLshort x, GLshort y);
  230. GLAPI void glVertex2sv(const GLshort* v);
  231. GLAPI void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
  232. GLAPI void glVertex3dv(const GLdouble* v);
  233. GLAPI void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
  234. GLAPI void glVertex3fv(const GLfloat* v);
  235. GLAPI void glVertex3i(GLint x, GLint y, GLint z);
  236. GLAPI void glVertex3iv(const GLint* v);
  237. GLAPI void glVertex3s(GLshort x, GLshort y, GLshort z);
  238. GLAPI void glVertex3sv(const GLshort* v);
  239. GLAPI void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
  240. GLAPI void glVertex4dv(const GLdouble* v);
  241. GLAPI void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
  242. GLAPI void glVertex4fv(const GLfloat* v);
  243. GLAPI void glVertex4i(GLint x, GLint y, GLint z, GLint w);
  244. GLAPI void glVertex4iv(const GLint* v);
  245. GLAPI void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
  246. GLAPI void glVertex4sv(const GLshort* v);
  247. GLAPI void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
  248. GLAPI void glEnable(GLenum cap);
  249. GLAPI void glDisable(GLenum cap);
  250. GLAPI void glCullFace(GLenum mode);
  251. GLAPI void glFrontFace(GLenum mode);
  252. GLAPI GLuint glGenLists(GLsizei range);
  253. GLAPI void glCallList(GLuint list);
  254. GLAPI void glDeleteLists(GLuint list, GLsizei range);
  255. GLAPI void glEndList(void);
  256. GLAPI void glNewList(GLuint list, GLenum mode);
  257. GLAPI void glFlush();
  258. GLAPI void glFinish();
  259. GLAPI void glBlendFunc(GLenum sfactor, GLenum dfactor);
  260. GLAPI void glShadeModel(GLenum mode);
  261. GLAPI void glAlphaFunc(GLenum func, GLclampf ref);
  262. GLAPI void glHint(GLenum target, GLenum mode);
  263. GLAPI void glReadBuffer(GLenum mode);
  264. GLAPI void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
  265. GLAPI void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data);
  266. GLAPI void glTexCoord2f(GLfloat s, GLfloat t);
  267. GLAPI void glBindTexture(GLenum target, GLuint texture);
  268. GLAPI void glActiveTexture(GLenum texture);
  269. GLAPI void glGetFloatv(GLenum pname, GLfloat* params);
  270. #ifdef __cplusplus
  271. }
  272. #endif