summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2022-12-05 17:09:03 +0100
committerAndreas Kling <kling@serenityos.org>2022-12-20 10:42:31 +0100
commit2da1c1c10e23e8a0857d6a977a59284b55103719 (patch)
tree5dd5b0d6a4897aab1066afc7c208f1a207d3d647 /Userland/Libraries/LibGL
parent8c094699dbb9e409e6ee0d82412f1f81372e35fe (diff)
downloadserenity-2da1c1c10e23e8a0857d6a977a59284b55103719.zip
LibGL: Generate the API wrappers
We now generate all LibGL API wrappers from a single API method definition list stored in `GLAPI.json`. Since a significant portion of the OpenGL API methods are relatively consistent variants, we take advantage of this to generate a lot of these variants at once. The autogenerated methods check for the non-nullness of the current `GLContext`, and only perform an action if a `GLContext` is present. This prevents a crash in ports like GLTron, who assume you can still call the OpenGL API without an active context. This increases our API wrapper method count from 211 to 356. Fixes #15814.
Diffstat (limited to 'Userland/Libraries/LibGL')
-rw-r--r--Userland/Libraries/LibGL/CMakeLists.txt8
-rw-r--r--Userland/Libraries/LibGL/GL/gl.h228
-rw-r--r--Userland/Libraries/LibGL/GLAPI.cpp1177
-rw-r--r--Userland/Libraries/LibGL/GLAPI.json1162
-rw-r--r--Userland/Libraries/LibGL/GLContext.h30
5 files changed, 1201 insertions, 1404 deletions
diff --git a/Userland/Libraries/LibGL/CMakeLists.txt b/Userland/Libraries/LibGL/CMakeLists.txt
index 88bd390fe9..d9235adb54 100644
--- a/Userland/Libraries/LibGL/CMakeLists.txt
+++ b/Userland/Libraries/LibGL/CMakeLists.txt
@@ -1,9 +1,10 @@
+include(libgl_generators)
+
set(SOURCES
Buffer/Buffer.cpp
Buffer.cpp
ClipPlane.cpp
ContextParameter.cpp
- GLAPI.cpp
GLContext.cpp
Image.cpp
Lighting.cpp
@@ -19,5 +20,10 @@ set(SOURCES
Vertex.cpp
)
+generate_libgl_implementation()
+
+set(GENERATED_SOURCES
+ GLAPI.cpp)
+
serenity_lib(LibGL gl)
target_link_libraries(LibGL PRIVATE LibCore LibGfx LibGLSL LibGPU)
diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h
index 0cfe285af4..56f617ef1a 100644
--- a/Userland/Libraries/LibGL/GL/gl.h
+++ b/Userland/Libraries/LibGL/GL/gl.h
@@ -1,13 +1,14 @@
/*
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
- * Copyright (c) 2021, Jelle Raaijmakers <jelle@gmta.nl>
+ * Copyright (c) 2021-2022, Jelle Raaijmakers <jelle@gmta.nl>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
+#include <LibGL/GL/glapi.h>
#include <LibGL/GL/glplatform.h>
#ifdef __cplusplus
@@ -610,231 +611,6 @@ extern "C" {
#define GL_INFO_LOG_LENGTH 0x8B84
#define GL_SHADER_SOURCE_LENGTH 0x8B88
-GLAPI void glBegin(GLenum mode);
-GLAPI void glClear(GLbitfield mask);
-GLAPI void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GLAPI void glClearDepth(GLdouble depth);
-GLAPI void glClearDepthf(GLfloat depth);
-GLAPI void glClearStencil(GLint s);
-GLAPI void glColor3d(GLdouble r, GLdouble g, GLdouble b);
-GLAPI void glColor3dv(GLdouble const* v);
-GLAPI void glColor3f(GLfloat r, GLfloat g, GLfloat b);
-GLAPI void glColor3fv(GLfloat const* v);
-GLAPI void glColor3ub(GLubyte r, GLubyte g, GLubyte b);
-GLAPI void glColor3ubv(GLubyte const* v);
-GLAPI void glColor4b(GLbyte r, GLbyte g, GLbyte b, GLbyte a);
-GLAPI void glColor4dv(GLdouble const* v);
-GLAPI void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
-GLAPI void glColor4fv(GLfloat const* v);
-GLAPI void glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
-GLAPI void glColor4ubv(GLubyte const* v);
-GLAPI void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GLAPI void glColorMaterial(GLenum face, GLenum mode);
-GLAPI void glDeleteTextures(GLsizei n, GLuint const* textures);
-GLAPI void glEnd();
-GLAPI void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal);
-GLAPI void glGenTextures(GLsizei n, GLuint* textures);
-GLAPI GLenum glGetError();
-GLAPI GLubyte const* glGetString(GLenum name);
-GLAPI void glLoadIdentity();
-GLAPI void glLoadMatrixd(GLdouble const* matrix);
-GLAPI void glLoadMatrixf(GLfloat const* matrix);
-GLAPI void glMatrixMode(GLenum mode);
-GLAPI void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal);
-GLAPI void glPushMatrix();
-GLAPI void glPopMatrix();
-GLAPI void glMultMatrixd(GLdouble const* matrix);
-GLAPI void glMultMatrixf(GLfloat const* matrix);
-GLAPI void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void glScaled(GLdouble x, GLdouble y, GLdouble z);
-GLAPI void glScalef(GLfloat x, GLfloat y, GLfloat z);
-GLAPI void glTranslated(GLdouble x, GLdouble y, GLdouble z);
-GLAPI void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
-GLAPI void glVertex2d(GLdouble x, GLdouble y);
-GLAPI void glVertex2dv(GLdouble const* v);
-GLAPI void glVertex2f(GLfloat x, GLfloat y);
-GLAPI void glVertex2fv(GLfloat const* v);
-GLAPI void glVertex2i(GLint x, GLint y);
-GLAPI void glVertex2iv(GLint const* v);
-GLAPI void glVertex2s(GLshort x, GLshort y);
-GLAPI void glVertex2sv(GLshort const* v);
-GLAPI void glVertex3d(GLdouble x, GLdouble y, GLdouble z);
-GLAPI void glVertex3dv(GLdouble const* v);
-GLAPI void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
-GLAPI void glVertex3fv(GLfloat const* v);
-GLAPI void glVertex3i(GLint x, GLint y, GLint z);
-GLAPI void glVertex3iv(GLint const* v);
-GLAPI void glVertex3s(GLshort x, GLshort y, GLshort z);
-GLAPI void glVertex3sv(GLshort const* v);
-GLAPI void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void glVertex4dv(GLdouble const* v);
-GLAPI void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void glVertex4fv(GLfloat const* v);
-GLAPI void glVertex4i(GLint x, GLint y, GLint z, GLint w);
-GLAPI void glVertex4iv(GLint const* v);
-GLAPI void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
-GLAPI void glVertex4sv(GLshort const* v);
-GLAPI void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void glEnable(GLenum cap);
-GLAPI void glDisable(GLenum cap);
-GLAPI GLboolean glIsEnabled(GLenum cap);
-GLAPI void glCullFace(GLenum mode);
-GLAPI void glFrontFace(GLenum mode);
-GLAPI GLuint glGenLists(GLsizei range);
-GLAPI void glCallList(GLuint list);
-GLAPI void glCallLists(GLsizei n, GLenum type, void const* lists);
-GLAPI void glDeleteLists(GLuint list, GLsizei range);
-GLAPI void glListBase(GLuint base);
-GLAPI void glEndList(void);
-GLAPI void glNewList(GLuint list, GLenum mode);
-GLAPI GLboolean glIsList(GLuint list);
-GLAPI void glFlush();
-GLAPI void glFinish();
-GLAPI void glBlendFunc(GLenum sfactor, GLenum dfactor);
-GLAPI void glShadeModel(GLenum mode);
-GLAPI void glAlphaFunc(GLenum func, GLclampf ref);
-GLAPI void glHint(GLenum target, GLenum mode);
-GLAPI void glReadBuffer(GLenum mode);
-GLAPI void glDrawBuffer(GLenum buffer);
-GLAPI void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
-GLAPI void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid const* data);
-GLAPI void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid const* data);
-GLAPI void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid const* data);
-GLAPI void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid const* data);
-GLAPI void glTexCoord1f(GLfloat s);
-GLAPI void glTexCoord1fv(GLfloat const* v);
-GLAPI void glTexCoord2d(GLdouble s, GLdouble t);
-GLAPI void glTexCoord2dv(GLdouble const* v);
-GLAPI void glTexCoord2f(GLfloat s, GLfloat t);
-GLAPI void glTexCoord2fv(GLfloat const* v);
-GLAPI void glTexCoord2i(GLint s, GLint t);
-GLAPI void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
-GLAPI void glTexCoord3fv(GLfloat const* v);
-GLAPI void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GLAPI void glTexCoord4fv(GLfloat const* v);
-GLAPI void glMultiTexCoord1f(GLenum target, GLfloat s);
-GLAPI void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
-GLAPI void glMultiTexCoord2fvARB(GLenum target, GLfloat const* v);
-GLAPI void glMultiTexCoord2fv(GLenum target, GLfloat const* v);
-GLAPI void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
-GLAPI void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);
-GLAPI void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GLAPI void glTexParameteri(GLenum target, GLenum pname, GLint param);
-GLAPI void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
-GLAPI void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
-GLAPI void glTexEnvi(GLenum target, GLenum pname, GLint param);
-GLAPI void glBindTexture(GLenum target, GLuint texture);
-GLAPI GLboolean glIsTexture(GLuint texture);
-GLAPI void glActiveTextureARB(GLenum texture);
-GLAPI void glActiveTexture(GLenum texture);
-GLAPI void glGetBooleanv(GLenum pname, GLboolean* data);
-GLAPI void glGetDoublev(GLenum pname, GLdouble* params);
-GLAPI void glGetFloatv(GLenum pname, GLfloat* params);
-GLAPI void glGetIntegerv(GLenum pname, GLint* data);
-GLAPI void glGetLightfv(GLenum light, GLenum pname, GLfloat* params);
-GLAPI void glGetLightiv(GLenum light, GLenum pname, GLint* params);
-GLAPI void glGetMaterialfv(GLenum face, GLenum pname, GLfloat* params);
-GLAPI void glGetMaterialiv(GLenum face, GLenum pname, GLint* params);
-GLAPI void glDepthMask(GLboolean flag);
-GLAPI void glEnableClientState(GLenum cap);
-GLAPI void glDisableClientState(GLenum cap);
-GLAPI void glClientActiveTextureARB(GLenum target);
-GLAPI void glClientActiveTexture(GLenum target);
-GLAPI void glVertexPointer(GLint size, GLenum type, GLsizei stride, void const* pointer);
-GLAPI void glColorPointer(GLint size, GLenum type, GLsizei stride, void const* pointer);
-GLAPI void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, void const* pointer);
-GLAPI void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-GLAPI void glDrawElements(GLenum mode, GLsizei count, GLenum type, void const* indices);
-GLAPI void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, void const* data);
-GLAPI void glDepthRange(GLdouble nearVal, GLdouble farVal);
-GLAPI void glDepthFunc(GLenum func);
-GLAPI void glPolygonMode(GLenum face, GLenum mode);
-GLAPI void glPolygonOffset(GLfloat factor, GLfloat units);
-GLAPI void glFogfv(GLenum mode, GLfloat const* params);
-GLAPI void glFogf(GLenum pname, GLfloat param);
-GLAPI void glFogi(GLenum pname, GLint param);
-GLAPI void glPixelStorei(GLenum pname, GLint param);
-GLAPI void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void glLightf(GLenum light, GLenum pname, GLfloat param);
-GLAPI void glLightfv(GLenum light, GLenum pname, GLfloat const* params);
-GLAPI void glLighti(GLenum light, GLenum pname, GLint param);
-GLAPI void glLightiv(GLenum light, GLenum pname, GLint const* params);
-GLAPI void glLightModelf(GLenum pname, GLfloat param);
-GLAPI void glLightModelfv(GLenum pname, GLfloat const* params);
-GLAPI void glLightModeli(GLenum pname, GLint param);
-GLAPI void glLightModeliv(GLenum pname, GLint const* params);
-GLAPI void glStencilFunc(GLenum func, GLint ref, GLuint mask);
-GLAPI void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
-GLAPI void glStencilMask(GLuint mask);
-GLAPI void glStencilMaskSeparate(GLenum face, GLuint mask);
-GLAPI void glStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass);
-GLAPI void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-GLAPI void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
-GLAPI void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
-GLAPI void glNormal3fv(GLfloat const* v);
-GLAPI void glNormalPointer(GLenum type, GLsizei stride, void const* pointer);
-GLAPI void glRasterPos2d(GLdouble x, GLdouble y);
-GLAPI void glRasterPos2f(GLfloat x, GLfloat y);
-GLAPI void glRasterPos2i(GLint x, GLint y);
-GLAPI void glRasterPos2s(GLshort x, GLshort y);
-GLAPI void glMaterialf(GLenum face, GLenum pname, GLfloat param);
-GLAPI void glMaterialfv(GLenum face, GLenum pname, GLfloat const* params);
-GLAPI void glMateriali(GLenum face, GLenum pname, GLint param);
-GLAPI void glMaterialiv(GLenum face, GLenum pname, GLint const* params);
-GLAPI void glLineWidth(GLfloat width);
-GLAPI void glPushAttrib(GLbitfield mask);
-GLAPI void glPopAttrib();
-GLAPI void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte const* bitmap);
-GLAPI void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GLAPI void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, GLdouble const* points);
-GLAPI void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, GLfloat const* points);
-GLAPI void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble const* points);
-GLAPI void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat const* points);
-GLAPI void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
-GLAPI void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
-GLAPI void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
-GLAPI void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
-GLAPI void glEvalCoord1d(GLdouble u);
-GLAPI void glEvalCoord1f(GLfloat u);
-GLAPI void glEvalCoord2d(GLdouble u, GLdouble v);
-GLAPI void glEvalCoord2f(GLfloat u, GLfloat v);
-GLAPI void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
-GLAPI void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
-GLAPI void glEvalPoint1(GLint i);
-GLAPI void glEvalPoint2(GLint i, GLint j);
-GLAPI void glTexGend(GLenum coord, GLenum pname, GLdouble param);
-GLAPI void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
-GLAPI void glTexGenfv(GLenum coord, GLenum pname, GLfloat const* params);
-GLAPI void glTexGeni(GLenum coord, GLenum pname, GLint param);
-GLAPI void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
-GLAPI void glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
-GLAPI void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void* pixels);
-GLAPI void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params);
-GLAPI void glPointSize(GLfloat size);
-GLAPI void glClipPlane(GLenum plane, GLdouble const* equation);
-GLAPI void glGetClipPlane(GLenum plane, GLdouble* equation);
-GLAPI void glArrayElement(GLint i);
-GLAPI void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void glBindBuffer(GLenum target, GLuint buffer);
-GLAPI void glBufferData(GLenum target, GLsizeiptr size, void const* data, GLenum usage);
-GLAPI void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void const* data);
-GLAPI void glDeleteBuffers(GLsizei n, GLuint const* buffers);
-GLAPI void glGenBuffers(GLsizei n, GLuint* buffers);
-
-GLAPI GLuint glCreateShader(GLenum shader_type);
-GLAPI void glDeleteShader(GLuint shader);
-GLAPI void glShaderSource(GLuint shader, GLsizei count, GLchar const** string, GLint const* length);
-GLAPI void glCompileShader(GLuint shader);
-GLAPI void glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
-
-GLAPI GLuint glCreateProgram();
-GLAPI void glDeleteProgram(GLuint program);
-GLAPI void glAttachShader(GLuint program, GLuint shader);
-GLAPI void glLinkProgram(GLuint program);
-GLAPI void glUseProgram(GLuint program);
-GLAPI void glGetProgramiv(GLuint program, GLenum pname, GLint* params);
-
#ifdef __cplusplus
}
#endif
diff --git a/Userland/Libraries/LibGL/GLAPI.cpp b/Userland/Libraries/LibGL/GLAPI.cpp
deleted file mode 100644
index 4790934a07..0000000000
--- a/Userland/Libraries/LibGL/GLAPI.cpp
+++ /dev/null
@@ -1,1177 +0,0 @@
-/*
- * Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
- * Copyright (c) 2021-2022, Jelle Raaijmakers <jelle@gmta.nl>
- * Copyright (c) 2021-2022, Jesse Buhagiar <jooster669@gmail.com>
- * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <AK/Array.h>
-#include <AK/Debug.h>
-#include <LibGL/GL/gl.h>
-#include <LibGL/GLContext.h>
-
-extern GL::GLContext* g_gl_context;
-
-// Transposes input matrices (column-major) to our Matrix (row-major).
-template<typename I>
-constexpr FloatMatrix4x4 transpose_input_matrix(I const* matrix)
-{
- Array<float, 16> elements;
- for (size_t i = 0; i < 16; ++i)
- elements[i] = static_cast<float>(matrix[i]);
- // clang-format off
- return {
- elements[0], elements[4], elements[8], elements[12],
- elements[1], elements[5], elements[9], elements[13],
- elements[2], elements[6], elements[10], elements[14],
- elements[3], elements[7], elements[11], elements[15],
- };
- // clang-format on
-}
-
-template<>
-constexpr FloatMatrix4x4 transpose_input_matrix(float const* matrix)
-{
- // clang-format off
- return {
- matrix[0], matrix[4], matrix[8], matrix[12],
- matrix[1], matrix[5], matrix[9], matrix[13],
- matrix[2], matrix[6], matrix[10], matrix[14],
- matrix[3], matrix[7], matrix[11], matrix[15],
- };
- // clang-format on
-}
-
-void glActiveTexture(GLenum texture)
-{
- g_gl_context->gl_active_texture(texture);
-}
-
-void glActiveTextureARB(GLenum texture)
-{
- glActiveTexture(texture);
-}
-
-void glAlphaFunc(GLenum func, GLclampf ref)
-{
- return g_gl_context->gl_alpha_func(func, ref);
-}
-
-void glArrayElement(GLint i)
-{
- g_gl_context->gl_array_element(i);
-}
-
-void glAttachShader(GLuint program, GLuint shader)
-{
- g_gl_context->gl_attach_shader(program, shader);
-}
-
-void glBegin(GLenum mode)
-{
- g_gl_context->gl_begin(mode);
-}
-
-void glBindBuffer(GLenum target, GLuint buffer)
-{
- g_gl_context->gl_bind_buffer(target, buffer);
-}
-
-void glBindTexture(GLenum target, GLuint texture)
-{
- g_gl_context->gl_bind_texture(target, texture);
-}
-
-void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte const* bitmap)
-{
- g_gl_context->gl_bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-void glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- return g_gl_context->gl_blend_func(sfactor, dfactor);
-}
-
-void glBufferData(GLenum target, GLsizeiptr size, void const* data, GLenum usage)
-{
- g_gl_context->gl_buffer_data(target, size, data, usage);
-}
-
-void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void const* data)
-{
- g_gl_context->gl_buffer_sub_data(target, offset, size, data);
-}
-
-void glCallList(GLuint list)
-{
- return g_gl_context->gl_call_list(list);
-}
-
-void glCallLists(GLsizei n, GLenum type, void const* lists)
-{
- return g_gl_context->gl_call_lists(n, type, lists);
-}
-
-void glClear(GLbitfield mask)
-{
- g_gl_context->gl_clear(mask);
-}
-
-void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- g_gl_context->gl_clear_color(red, green, blue, alpha);
-}
-
-void glClearDepth(GLdouble depth)
-{
- g_gl_context->gl_clear_depth(depth);
-}
-
-void glClearDepthf(GLfloat depth)
-{
- g_gl_context->gl_clear_depth(static_cast<double>(depth));
-}
-
-void glClearStencil(GLint s)
-{
- g_gl_context->gl_clear_stencil(s);
-}
-
-void glClientActiveTexture(GLenum target)
-{
- g_gl_context->gl_client_active_texture(target);
-}
-
-void glClientActiveTextureARB(GLenum target)
-{
- glClientActiveTexture(target);
-}
-
-void glClipPlane(GLenum plane, GLdouble const* equation)
-{
- g_gl_context->gl_clip_plane(plane, equation);
-}
-
-void glColor3d(GLdouble r, GLdouble g, GLdouble b)
-{
- g_gl_context->gl_color(r, g, b, 1.0);
-}
-
-void glColor3dv(GLdouble const* v)
-{
- g_gl_context->gl_color(v[0], v[1], v[2], 1.0);
-}
-
-void glColor3f(GLfloat r, GLfloat g, GLfloat b)
-{
- g_gl_context->gl_color(r, g, b, 1.0);
-}
-
-void glColor3fv(GLfloat const* v)
-{
- g_gl_context->gl_color(v[0], v[1], v[2], 1.0);
-}
-
-void glColor3ub(GLubyte r, GLubyte g, GLubyte b)
-{
- g_gl_context->gl_color(r / 255.0, g / 255.0, b / 255.0, 1.0);
-}
-
-void glColor3ubv(GLubyte const* v)
-{
- g_gl_context->gl_color(v[0] / 255.0, v[1] / 255.0, v[2] / 255.0, 1.0);
-}
-
-void glColor4b(GLbyte r, GLbyte g, GLbyte b, GLbyte a)
-{
- g_gl_context->gl_color(
- (static_cast<double>(r) + 128) / 127.5 - 1,
- (static_cast<double>(g) + 128) / 127.5 - 1,
- (static_cast<double>(b) + 128) / 127.5 - 1,
- (static_cast<double>(a) + 128) / 127.5 - 1);
-}
-
-void glColor4dv(GLdouble const* v)
-{
- g_gl_context->gl_color(v[0], v[1], v[2], v[3]);
-}
-
-void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
-{
- g_gl_context->gl_color(r, g, b, a);
-}
-
-void glColor4fv(GLfloat const* v)
-{
- g_gl_context->gl_color(v[0], v[1], v[2], v[3]);
-}
-
-void glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a)
-{
- g_gl_context->gl_color(r / 255.0, g / 255.0, b / 255.0, a / 255.0);
-}
-
-void glColor4ubv(GLubyte const* v)
-{
- g_gl_context->gl_color(v[0] / 255.0, v[1] / 255.0, v[2] / 255.0, v[3] / 255.0);
-}
-
-void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- g_gl_context->gl_color_mask(red, green, blue, alpha);
-}
-
-void glColorMaterial(GLenum face, GLenum mode)
-{
- g_gl_context->gl_color_material(face, mode);
-}
-
-void glColorPointer(GLint size, GLenum type, GLsizei stride, void const* pointer)
-{
- g_gl_context->gl_color_pointer(size, type, stride, pointer);
-}
-
-void glCompileShader(GLuint shader)
-{
- g_gl_context->gl_compile_shader(shader);
-}
-
-void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- g_gl_context->gl_copy_tex_image_2d(target, level, internalformat, x, y, width, height, border);
-}
-
-void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- g_gl_context->gl_copy_tex_sub_image_2d(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-GLuint glCreateProgram()
-{
- return g_gl_context->gl_create_program();
-}
-
-GLuint glCreateShader(GLenum shader_type)
-{
- return g_gl_context->gl_create_shader(shader_type);
-}
-
-void glCullFace(GLenum mode)
-{
- g_gl_context->gl_cull_face(mode);
-}
-
-void glDeleteBuffers(GLsizei n, GLuint const* buffers)
-{
- g_gl_context->gl_delete_buffers(n, buffers);
-}
-
-void glDepthFunc(GLenum func)
-{
- g_gl_context->gl_depth_func(func);
-}
-
-void glDepthMask(GLboolean flag)
-{
- g_gl_context->gl_depth_mask(flag);
-}
-
-void glDepthRange(GLdouble min, GLdouble max)
-{
- g_gl_context->gl_depth_range(min, max);
-}
-
-void glDeleteLists(GLuint list, GLsizei range)
-{
- return g_gl_context->gl_delete_lists(list, range);
-}
-
-void glDeleteProgram(GLuint program)
-{
- g_gl_context->gl_delete_program(program);
-}
-
-void glDeleteShader(GLuint shader)
-{
- g_gl_context->gl_delete_shader(shader);
-}
-
-void glDeleteTextures(GLsizei n, GLuint const* textures)
-{
- g_gl_context->gl_delete_textures(n, textures);
-}
-
-void glDisable(GLenum cap)
-{
- g_gl_context->gl_disable(cap);
-}
-
-void glDisableClientState(GLenum cap)
-{
- g_gl_context->gl_disable_client_state(cap);
-}
-
-void glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- g_gl_context->gl_draw_arrays(mode, first, count);
-}
-
-void glDrawBuffer(GLenum buffer)
-{
- g_gl_context->gl_draw_buffer(buffer);
-}
-
-void glDrawElements(GLenum mode, GLsizei count, GLenum type, void const* indices)
-{
- g_gl_context->gl_draw_elements(mode, count, type, indices);
-}
-
-void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, void const* data)
-{
- g_gl_context->gl_draw_pixels(width, height, format, type, data);
-}
-
-void glEnable(GLenum cap)
-{
- g_gl_context->gl_enable(cap);
-}
-
-void glEnableClientState(GLenum cap)
-{
- g_gl_context->gl_enable_client_state(cap);
-}
-
-void glEnd()
-{
- g_gl_context->gl_end();
-}
-
-void glEndList(void)
-{
- return g_gl_context->gl_end_list();
-}
-
-void glEvalCoord1d(GLdouble u)
-{
- dbgln("glEvalCoord1d({}): unimplemented", u);
- TODO();
-}
-
-void glEvalCoord1f(GLfloat u)
-{
- dbgln("glEvalCoord1f({}): unimplemented", u);
- TODO();
-}
-
-void glEvalCoord2d(GLdouble u, GLdouble v)
-{
- dbgln("glEvalCoord2d({}, {}): unimplemented", u, v);
- TODO();
-}
-
-void glEvalCoord2f(GLfloat u, GLfloat v)
-{
- dbgln("glEvalCoord2f({}, {}): unimplemented", u, v);
- TODO();
-}
-
-void glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- dbgln("glEvalMesh1({:#x}, {}, {}): unimplemented", mode, i1, i2);
- TODO();
-}
-
-void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- dbgln("glEvalMesh2({:#x}, {}, {}, {}, {}): unimplemented", mode, i1, i2, j1, j2);
- TODO();
-}
-
-void glEvalPoint1(GLint i)
-{
- dbgln("glEvalPoint1({}): unimplemented", i);
- TODO();
-}
-
-void glEvalPoint2(GLint i, GLint j)
-{
- dbgln("glEvalPoint2({}, {}): unimplemented", i, j);
- TODO();
-}
-
-void glFinish()
-{
- g_gl_context->gl_finish();
-}
-
-void glFogfv(GLenum pname, GLfloat const* params)
-{
- g_gl_context->gl_fogfv(pname, params);
-}
-
-void glFogf(GLenum pname, GLfloat param)
-{
- g_gl_context->gl_fogf(pname, param);
-}
-
-void glFogi(GLenum pname, GLint param)
-{
- g_gl_context->gl_fogi(pname, param);
-}
-
-void glFlush()
-{
- g_gl_context->gl_flush();
-}
-
-void glFrontFace(GLenum mode)
-{
- g_gl_context->gl_front_face(mode);
-}
-
-void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal)
-{
- g_gl_context->gl_frustum(left, right, bottom, top, nearVal, farVal);
-}
-
-void glGenBuffers(GLsizei n, GLuint* buffers)
-{
- g_gl_context->gl_gen_buffers(n, buffers);
-}
-
-GLuint glGenLists(GLsizei range)
-{
- return g_gl_context->gl_gen_lists(range);
-}
-
-void glGenTextures(GLsizei n, GLuint* textures)
-{
- g_gl_context->gl_gen_textures(n, textures);
-}
-
-void glGetBooleanv(GLenum pname, GLboolean* data)
-{
- g_gl_context->gl_get_booleanv(pname, data);
-}
-
-void glGetClipPlane(GLenum plane, GLdouble* equation)
-{
- g_gl_context->gl_get_clip_plane(plane, equation);
-}
-
-void glGetDoublev(GLenum pname, GLdouble* params)
-{
- g_gl_context->gl_get_doublev(pname, params);
-}
-
-GLenum glGetError()
-{
- return g_gl_context->gl_get_error();
-}
-
-void glGetFloatv(GLenum pname, GLfloat* params)
-{
- g_gl_context->gl_get_floatv(pname, params);
-}
-
-void glGetIntegerv(GLenum pname, GLint* data)
-{
- g_gl_context->gl_get_integerv(pname, data);
-}
-
-void glGetLightfv(GLenum light, GLenum pname, GLfloat* params)
-{
- g_gl_context->gl_get_light(light, pname, params, GL_FLOAT);
-}
-
-void glGetLightiv(GLenum light, GLenum pname, GLint* params)
-{
- g_gl_context->gl_get_light(light, pname, params, GL_INT);
-}
-
-void glGetMaterialfv(GLenum face, GLenum pname, GLfloat* params)
-{
- g_gl_context->gl_get_material(face, pname, params, GL_FLOAT);
-}
-
-void glGetMaterialiv(GLenum face, GLenum pname, GLint* params)
-{
- g_gl_context->gl_get_material(face, pname, params, GL_INT);
-}
-
-void glGetProgramiv(GLuint program, GLenum pname, GLint* params)
-{
- g_gl_context->gl_get_program(program, pname, params);
-}
-
-GLubyte const* glGetString(GLenum name)
-{
- return g_gl_context->gl_get_string(name);
-}
-
-void glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
-{
- g_gl_context->gl_get_shader(shader, pname, params);
-}
-
-void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void* pixels)
-{
- g_gl_context->gl_get_tex_image(target, level, format, type, pixels);
-}
-
-void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params)
-{
- g_gl_context->gl_get_tex_parameter_integerv(target, level, pname, params);
-}
-
-void glHint(GLenum target, GLenum mode)
-{
- g_gl_context->gl_hint(target, mode);
-}
-
-GLboolean glIsEnabled(GLenum cap)
-{
- return g_gl_context->gl_is_enabled(cap);
-}
-
-GLboolean glIsList(GLuint list)
-{
- return g_gl_context->gl_is_list(list);
-}
-
-GLboolean glIsTexture(GLuint texture)
-{
- return g_gl_context->gl_is_texture(texture);
-}
-
-void glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- g_gl_context->gl_lightf(light, pname, param);
-}
-
-void glLightfv(GLenum light, GLenum pname, GLfloat const* param)
-{
- g_gl_context->gl_lightfv(light, pname, param);
-}
-
-void glLighti(GLenum light, GLenum pname, GLint param)
-{
- g_gl_context->gl_lightf(light, pname, param);
-}
-
-void glLightiv(GLenum light, GLenum pname, GLint const* params)
-{
- g_gl_context->gl_lightiv(light, pname, params);
-}
-
-void glLightModelf(GLenum pname, GLfloat param)
-{
- g_gl_context->gl_light_model(pname, param, 0.f, 0.f, 0.f);
-}
-
-void glLightModelfv(GLenum pname, GLfloat const* params)
-{
- g_gl_context->gl_light_modelv(pname, params, GL_FLOAT);
-}
-
-void glLightModeliv(GLenum pname, GLint const* params)
-{
- g_gl_context->gl_light_modelv(pname, params, GL_INT);
-}
-
-void glLightModeli(GLenum pname, GLint param)
-{
- g_gl_context->gl_light_model(pname, static_cast<float>(param), 0.f, 0.f, 0.f);
-}
-
-void glLineWidth(GLfloat width)
-{
- g_gl_context->gl_line_width(width);
-}
-
-void glLinkProgram(GLuint program)
-{
- g_gl_context->gl_link_program(program);
-}
-
-void glListBase(GLuint base)
-{
- return g_gl_context->gl_list_base(base);
-}
-
-void glLoadIdentity()
-{
- g_gl_context->gl_load_identity();
-}
-
-void glLoadMatrixd(GLdouble const* matrix)
-{
- g_gl_context->gl_load_matrix(transpose_input_matrix(matrix));
-}
-
-void glLoadMatrixf(GLfloat const* matrix)
-{
- g_gl_context->gl_load_matrix(transpose_input_matrix(matrix));
-}
-
-void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, GLdouble const* points)
-{
- dbgln("glMap1d({:#x}, {}, {}, {}, {}, {:p}): unimplemented", target, u1, u2, stride, order, points);
- TODO();
-}
-
-void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, GLfloat const* points)
-{
- dbgln("glMap1f({:#x}, {}, {}, {}, {}, {:p}): unimplemented", target, u1, u2, stride, order, points);
- TODO();
-}
-
-void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble const* points)
-{
- dbgln("glMap2d({:#x}, {}, {}, {}, {}, {}, {}, {}, {}, {:p}): unimplemented", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
- TODO();
-}
-
-void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat const* points)
-{
- dbgln("glMap2f({:#x}, {}, {}, {}, {}, {}, {}, {}, {}, {:p}): unimplemented", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
- TODO();
-}
-
-void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- dbgln("glMapGrid1d({}, {}, {}): unimplemented", un, u1, u2);
- TODO();
-}
-
-void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- dbgln("glMapGrid1f({}, {}, {}): unimplemented", un, u1, u2);
- TODO();
-}
-
-void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- dbgln("glMapGrid2d({}, {}, {}, {}, {}, {}): unimplemented", un, u1, u2, vn, v1, v2);
- TODO();
-}
-
-void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- dbgln("glMapGrid2f({}, {}, {}, {}, {}, {}): unimplemented", un, u1, u2, vn, v1, v2);
- TODO();
-}
-
-void glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- g_gl_context->gl_materialf(face, pname, param);
-}
-
-void glMaterialfv(GLenum face, GLenum pname, GLfloat const* params)
-{
- g_gl_context->gl_materialfv(face, pname, params);
-}
-
-void glMateriali(GLenum face, GLenum pname, GLint param)
-{
- g_gl_context->gl_materialf(face, pname, param);
-}
-
-void glMaterialiv(GLenum face, GLenum pname, GLint const* params)
-{
- g_gl_context->gl_materialiv(face, pname, params);
-}
-
-void glMatrixMode(GLenum mode)
-{
- g_gl_context->gl_matrix_mode(mode);
-}
-
-void glMultiTexCoord1f(GLenum target, GLfloat s)
-{
- g_gl_context->gl_multi_tex_coord(target, s, 0.f, 0.f, 1.f);
-}
-
-void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
-{
- glMultiTexCoord2f(target, s, t);
-}
-
-void glMultiTexCoord2fvARB(GLenum target, GLfloat const* v)
-{
- glMultiTexCoord2fv(target, v);
-}
-
-void glMultiTexCoord2fv(GLenum target, GLfloat const* v)
-{
- g_gl_context->gl_multi_tex_coord(target, v[0], v[1], 0.f, 1.f);
-}
-
-void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
-{
- g_gl_context->gl_multi_tex_coord(target, s, t, 0.f, 1.f);
-}
-
-void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- g_gl_context->gl_multi_tex_coord(target, s, t, r, 1.f);
-}
-
-void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- g_gl_context->gl_multi_tex_coord(target, s, t, r, q);
-}
-
-void glMultMatrixd(GLdouble const* matrix)
-{
- g_gl_context->gl_mult_matrix(transpose_input_matrix(matrix));
-}
-
-void glMultMatrixf(GLfloat const* matrix)
-{
- g_gl_context->gl_mult_matrix(transpose_input_matrix(matrix));
-}
-
-void glNewList(GLuint list, GLenum mode)
-{
- return g_gl_context->gl_new_list(list, mode);
-}
-
-void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- g_gl_context->gl_normal(nx, ny, nz);
-}
-
-void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- g_gl_context->gl_normal(nx, ny, nz);
-}
-
-void glNormal3fv(GLfloat const* v)
-{
- g_gl_context->gl_normal(v[0], v[1], v[2]);
-}
-
-void glNormalPointer(GLenum type, GLsizei stride, void const* pointer)
-{
- g_gl_context->gl_normal_pointer(type, stride, pointer);
-}
-
-void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal)
-{
- g_gl_context->gl_ortho(left, right, bottom, top, nearVal, farVal);
-}
-
-void glPixelStorei(GLenum pname, GLint param)
-{
- g_gl_context->gl_pixel_storei(pname, param);
-}
-
-void glPointSize(GLfloat size)
-{
- g_gl_context->gl_point_size(size);
-}
-
-void glPolygonMode(GLenum face, GLenum mode)
-{
- g_gl_context->gl_polygon_mode(face, mode);
-}
-
-void glPolygonOffset(GLfloat factor, GLfloat units)
-{
- g_gl_context->gl_polygon_offset(factor, units);
-}
-
-void glPopAttrib()
-{
- g_gl_context->gl_pop_attrib();
-}
-
-void glPopMatrix()
-{
- g_gl_context->gl_pop_matrix();
-}
-
-void glPushAttrib(GLbitfield mask)
-{
- g_gl_context->gl_push_attrib(mask);
-}
-
-void glPushMatrix()
-{
- g_gl_context->gl_push_matrix();
-}
-
-void glRasterPos2d(GLdouble x, GLdouble y)
-{
- g_gl_context->gl_raster_pos(static_cast<float>(x), static_cast<float>(y), 0.f, 1.f);
-}
-
-void glRasterPos2f(GLfloat x, GLfloat y)
-{
- g_gl_context->gl_raster_pos(x, y, 0.f, 1.f);
-}
-
-void glRasterPos2i(GLint x, GLint y)
-{
- g_gl_context->gl_raster_pos(static_cast<float>(x), static_cast<float>(y), 0.f, 1.f);
-}
-
-void glRasterPos2s(GLshort x, GLshort y)
-{
- g_gl_context->gl_raster_pos(static_cast<float>(x), static_cast<float>(y), 0.f, 1.f);
-}
-
-void glReadBuffer(GLenum mode)
-{
- g_gl_context->gl_read_buffer(mode);
-}
-
-void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
-{
- g_gl_context->gl_read_pixels(x, y, width, height, format, type, pixels);
-}
-
-void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- g_gl_context->gl_rect(x1, y1, x2, y2);
-}
-
-void glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- g_gl_context->gl_rect(x1, y1, x2, y2);
-}
-
-void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- g_gl_context->gl_rotate(angle, x, y, z);
-}
-
-void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- g_gl_context->gl_rotate(angle, x, y, z);
-}
-
-void glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- g_gl_context->gl_scale(x, y, z);
-}
-
-void glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- g_gl_context->gl_scale(x, y, z);
-}
-
-void glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- g_gl_context->gl_scissor(x, y, width, height);
-}
-
-void glShadeModel(GLenum mode)
-{
- g_gl_context->gl_shade_model(mode);
-}
-
-void glShaderSource(GLuint shader, GLsizei count, GLchar const** string, GLint const* length)
-{
- g_gl_context->gl_shader_source(shader, count, string, length);
-}
-
-void glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- g_gl_context->gl_stencil_func_separate(GL_FRONT_AND_BACK, func, ref, mask);
-}
-
-void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- g_gl_context->gl_stencil_func_separate(face, func, ref, mask);
-}
-
-void glStencilMask(GLuint mask)
-{
- g_gl_context->gl_stencil_mask_separate(GL_FRONT_AND_BACK, mask);
-}
-
-void glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- g_gl_context->gl_stencil_mask_separate(face, mask);
-}
-
-void glStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- g_gl_context->gl_stencil_op_separate(GL_FRONT_AND_BACK, sfail, dpfail, dppass);
-}
-
-void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
-{
- g_gl_context->gl_stencil_op_separate(face, sfail, dpfail, dppass);
-}
-
-void glTexCoord1f(GLfloat s)
-{
- g_gl_context->gl_tex_coord(s, 0.0f, 0.0f, 1.0f);
-}
-
-void glTexCoord1fv(GLfloat const* v)
-{
- g_gl_context->gl_tex_coord(v[0], 0.0f, 0.0f, 1.0f);
-}
-
-void glTexCoord2d(GLdouble s, GLdouble t)
-{
- g_gl_context->gl_tex_coord(s, t, 0.0f, 1.0f);
-}
-
-void glTexCoord2dv(GLdouble const* v)
-{
- g_gl_context->gl_tex_coord(v[0], v[1], 0.0f, 1.0f);
-}
-
-void glTexCoord2f(GLfloat s, GLfloat t)
-{
- g_gl_context->gl_tex_coord(s, t, 0.0f, 1.0f);
-}
-
-void glTexCoord2fv(GLfloat const* v)
-{
- g_gl_context->gl_tex_coord(v[0], v[1], 0.0f, 1.0f);
-}
-
-void glTexCoord2i(GLint s, GLint t)
-{
- g_gl_context->gl_tex_coord(s, t, 0.0f, 1.0f);
-}
-
-void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- g_gl_context->gl_tex_coord(s, t, r, 1.0f);
-}
-
-void glTexCoord3fv(GLfloat const* v)
-{
- g_gl_context->gl_tex_coord(v[0], v[1], v[2], 1.0f);
-}
-
-void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- g_gl_context->gl_tex_coord(s, t, r, q);
-}
-
-void glTexCoord4fv(GLfloat const* v)
-{
- g_gl_context->gl_tex_coord(v[0], v[1], v[2], v[3]);
-}
-
-void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, void const* pointer)
-{
- g_gl_context->gl_tex_coord_pointer(size, type, stride, pointer);
-}
-
-void glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- g_gl_context->gl_tex_env(target, pname, param);
-}
-
-void glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- g_gl_context->gl_tex_env(target, pname, param);
-}
-
-void glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- g_gl_context->gl_tex_gen(coord, pname, param);
-}
-
-void glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- g_gl_context->gl_tex_gen(coord, pname, param);
-}
-
-void glTexGenfv(GLenum coord, GLenum pname, GLfloat const* params)
-{
- g_gl_context->gl_tex_gen_floatv(coord, pname, params);
-}
-
-void glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- g_gl_context->gl_tex_gen(coord, pname, param);
-}
-
-void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid const* data)
-{
- dbgln("glTexImage1D({:#x}, {}, {:#x}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, border, format, type, data);
- TODO();
-}
-
-void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid const* data)
-{
- g_gl_context->gl_tex_image_2d(target, level, internalFormat, width, height, border, format, type, data);
-}
-
-void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid const* data)
-{
- dbgln("glTexImage3D({:#x}, {}, {:#x}, {}, {}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, height, depth, border, format, type, data);
- TODO();
-}
-
-void glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- g_gl_context->gl_tex_parameter(target, pname, param);
-}
-
-void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- g_gl_context->gl_tex_parameter(target, pname, param);
-}
-
-void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid const* data)
-{
- g_gl_context->gl_tex_sub_image_2d(target, level, xoffset, yoffset, width, height, format, type, data);
-}
-
-void glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- g_gl_context->gl_translate(x, y, z);
-}
-
-void glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- g_gl_context->gl_translate(x, y, z);
-}
-
-void glUseProgram(GLuint program)
-{
- g_gl_context->gl_use_program(program);
-}
-
-void glVertex2d(GLdouble x, GLdouble y)
-{
- g_gl_context->gl_vertex(x, y, 0.0, 1.0);
-}
-
-void glVertex2dv(GLdouble const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
-}
-
-void glVertex2f(GLfloat x, GLfloat y)
-{
- g_gl_context->gl_vertex(x, y, 0.0, 1.0);
-}
-
-void glVertex2fv(GLfloat const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
-}
-
-void glVertex2i(GLint x, GLint y)
-{
- g_gl_context->gl_vertex(x, y, 0.0, 1.0);
-}
-
-void glVertex2iv(GLint const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
-}
-
-void glVertex2s(GLshort x, GLshort y)
-{
- g_gl_context->gl_vertex(x, y, 0.0, 1.0);
-}
-
-void glVertex2sv(GLshort const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
-}
-
-void glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- g_gl_context->gl_vertex(x, y, z, 1.0);
-}
-
-void glVertex3dv(GLdouble const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
-}
-
-void glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- g_gl_context->gl_vertex(x, y, z, 1.0);
-}
-
-void glVertex3fv(GLfloat const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
-}
-
-void glVertex3i(GLint x, GLint y, GLint z)
-{
- g_gl_context->gl_vertex(x, y, z, 1.0);
-}
-
-void glVertex3iv(GLint const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
-}
-
-void glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- g_gl_context->gl_vertex(x, y, z, 1.0);
-}
-
-void glVertex3sv(GLshort const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
-}
-
-void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- g_gl_context->gl_vertex(x, y, z, w);
-}
-
-void glVertex4dv(GLdouble const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
-}
-
-void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- g_gl_context->gl_vertex(x, y, z, w);
-}
-
-void glVertex4fv(GLfloat const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
-}
-
-void glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- g_gl_context->gl_vertex(x, y, z, w);
-}
-
-void glVertex4iv(GLint const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
-}
-
-void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- g_gl_context->gl_vertex(x, y, z, w);
-}
-
-void glVertex4sv(GLshort const* v)
-{
- g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
-}
-
-void glVertexPointer(GLint size, GLenum type, GLsizei stride, void const* pointer)
-{
- g_gl_context->gl_vertex_pointer(size, type, stride, pointer);
-}
-
-void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- g_gl_context->gl_viewport(x, y, width, height);
-}
diff --git a/Userland/Libraries/LibGL/GLAPI.json b/Userland/Libraries/LibGL/GLAPI.json
new file mode 100644
index 0000000000..82c812512c
--- /dev/null
+++ b/Userland/Libraries/LibGL/GLAPI.json
@@ -0,0 +1,1162 @@
+{
+ "ActiveTexture": {
+ "arguments": [
+ {"type": "GLenum", "name": "texture"}
+ ],
+ "variants": {
+ "api_suffixes": ["", "ARB"]
+ }
+ },
+ "AlphaFunc": {
+ "arguments": [
+ {"type": "GLenum", "name": "func"},
+ {"type": "GLclampf", "name": "ref"}
+ ]
+ },
+ "ArrayElement": {
+ "arguments": [
+ {"type": "GLint", "name": "i"}
+ ]
+ },
+ "AttachShader": {
+ "arguments": [
+ {"type": "GLuint", "name": "program"},
+ {"type": "GLuint", "name": "shader"}
+ ]
+ },
+ "Begin": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"}
+ ]
+ },
+ "BindBuffer": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLuint", "name": "buffer"}
+ ]
+ },
+ "BindTexture": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLuint", "name": "texture"}
+ ]
+ },
+ "Bitmap": {
+ "arguments": [
+ {"type": "GLsizei", "name": ["width", "height"]},
+ {"type": "GLfloat", "name": ["xorig", "yorig", "xmove", "ymove"]},
+ {"type": "GLubyte const*", "name": "bitmap"}
+ ]
+ },
+ "BlendFunc": {
+ "arguments": [
+ {"type": "GLenum", "name": ["sfactor", "dfactor"]}
+ ]
+ },
+ "BufferData": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLsizeiptr", "name": "size"},
+ {"type": "void const*", "name": "data"},
+ {"type": "GLenum", "name": "usage"}
+ ]
+ },
+ "BufferSubData": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLintptr", "name": "offset"},
+ {"type": "GLsizeiptr", "name": "size"},
+ {"type": "void const*", "name": "data"}
+ ]
+ },
+ "CallList": {
+ "arguments": [
+ {"type": "GLuint", "name": "list"}
+ ]
+ },
+ "CallLists": {
+ "arguments": [
+ {"type": "GLsizei", "name": "n"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "void const*", "name": "lists"}
+ ]
+ },
+ "Clear": {
+ "arguments": [
+ {"type": "GLbitfield", "name": "mask"}
+ ]
+ },
+ "ClearColor": {
+ "arguments": [
+ {"type": "GLclampf", "name": ["red", "green", "blue", "alpha"]}
+ ]
+ },
+ "ClearDepth": {
+ "arguments": [
+ {"type": "GLdouble", "name": "depth"}
+ ]
+ },
+ "ClearDepthf": {
+ "arguments": [
+ {"type": "GLfloat", "name": "depth", "cast_to": "GLdouble"}
+ ],
+ "implementation": "clear_depth"
+ },
+ "ClearStencil": {
+ "arguments": [
+ {"type": "GLint", "name": "s"}
+ ]
+ },
+ "ClientActiveTexture": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"}
+ ],
+ "variants": {
+ "api_suffixes": ["", "ARB"]
+ }
+ },
+ "ClipPlane": {
+ "arguments": [
+ {"type": "GLenum", "name": "plane"},
+ {"type": "GLdouble const*", "name": "equation"}
+ ]
+ },
+ "Color": {
+ "arguments": [
+ {"name": ["red", "green", "blue", "alpha"], "cast_to": "GLdouble"}
+ ],
+ "variants": {
+ "argument_counts": [3, 4],
+ "argument_defaults": ["0.", "0.", "0.", "1."],
+ "convert_range": true,
+ "pointer_argument": "v",
+ "types": {
+ "b": {},
+ "bv": {},
+ "d": {},
+ "dv": {},
+ "f": {},
+ "fv": {},
+ "i": {},
+ "iv": {},
+ "s": {},
+ "sv": {},
+ "ub": {},
+ "ubv": {},
+ "ui": {},
+ "uiv": {},
+ "us": {},
+ "usv": {}
+ }
+ }
+ },
+ "ColorMask": {
+ "arguments": [
+ {"type": "GLboolean", "name": ["red", "green", "blue", "alpha"]}
+ ]
+ },
+ "ColorMaterial": {
+ "arguments": [
+ {"type": "GLenum", "name": "face"},
+ {"type": "GLenum", "name": "mode"}
+ ]
+ },
+ "ColorPointer": {
+ "arguments": [
+ {"type": "GLint", "name": "size"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "GLsizei", "name": "stride"},
+ {"type": "void const*", "name": "pointer"}
+ ]
+ },
+ "CompileShader": {
+ "arguments": [
+ {"type": "GLuint", "name": "shader"}
+ ]
+ },
+ "CopyTexImage2D": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": "level"},
+ {"type": "GLenum", "name": "internalformat"},
+ {"type": "GLint", "name": ["x", "y"]},
+ {"type": "GLsizei", "name": ["width", "height"]},
+ {"type": "GLint", "name": "border"}
+ ],
+ "implementation": "copy_tex_image_2d"
+ },
+ "CopyTexSubImage2D": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": ["level", "xoffset", "yoffset", "x", "y"]},
+ {"type": "GLsizei", "name": ["width", "height"]}
+ ],
+ "implementation": "copy_tex_sub_image_2d"
+ },
+ "CreateProgram": {
+ "return_type": "GLuint"
+ },
+ "CreateShader": {
+ "arguments": [
+ {"type": "GLenum", "name": "shader_type"}
+ ],
+ "return_type": "GLuint"
+ },
+ "CullFace": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"}
+ ]
+ },
+ "DeleteBuffers": {
+ "arguments": [
+ {"type": "GLsizei", "name": "n"},
+ {"type": "GLuint const*", "name": "buffers"}
+ ]
+ },
+ "DeleteLists": {
+ "arguments": [
+ {"type": "GLuint", "name": "list"},
+ {"type": "GLsizei", "name": "range"}
+ ]
+ },
+ "DeleteProgram": {
+ "arguments": [
+ {"type": "GLuint", "name": "program"}
+ ]
+ },
+ "DeleteShader": {
+ "arguments": [
+ {"type": "GLuint", "name": "shader"}
+ ]
+ },
+ "DeleteTextures": {
+ "arguments": [
+ {"type": "GLsizei", "name": "n"},
+ {"type": "GLuint const*", "name": "textures"}
+ ]
+ },
+ "DepthFunc": {
+ "arguments": [
+ {"type": "GLenum", "name": "func"}
+ ]
+ },
+ "DepthMask": {
+ "arguments": [
+ {"type": "GLboolean", "name": "flag"}
+ ]
+ },
+ "DepthRange": {
+ "arguments": [
+ {"type": "GLdouble", "name": ["nearVal", "farVal"]}
+ ]
+ },
+ "DepthRangef": {
+ "arguments": [
+ {"type": "GLfloat", "name": ["nearVal", "farVal"], "cast_to": "GLdouble"}
+ ],
+ "implementation": "depth_range"
+ },
+ "Disable": {
+ "arguments": [
+ {"type": "GLenum", "name": "cap"}
+ ]
+ },
+ "DisableClientState": {
+ "arguments": [
+ {"type": "GLenum", "name": "cap"}
+ ]
+ },
+ "DrawArrays": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"},
+ {"type": "GLint", "name": "first"},
+ {"type": "GLsizei", "name": "count"}
+ ]
+ },
+ "DrawBuffer": {
+ "arguments": [
+ {"type": "GLenum", "name": "buffer"}
+ ]
+ },
+ "DrawElements": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"},
+ {"type": "GLsizei", "name": "count"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "void const*", "name": "indices"}
+ ]
+ },
+ "DrawPixels": {
+ "arguments": [
+ {"type": "GLsizei", "name": ["width", "height"]},
+ {"type": "GLenum", "name": ["format", "type"]},
+ {"type": "void const*", "name": "data"}
+ ]
+ },
+ "Enable": {
+ "arguments": [
+ {"type": "GLenum", "name": "cap"}
+ ]
+ },
+ "EnableClientState": {
+ "arguments": [
+ {"type": "GLenum", "name": "cap"}
+ ]
+ },
+ "End": {},
+ "EndList": {},
+ "EvalCoord": {
+ "arguments": [
+ {"name": ["u", "v"]}
+ ],
+ "unimplemented": true,
+ "variants": {
+ "argument_counts": [1, 2],
+ "argument_defaults": ["0.", "0."],
+ "pointer_argument": "u",
+ "types": {
+ "d": {},
+ "dv": {},
+ "f": {},
+ "fv": {}
+ }
+ }
+ },
+ "EvalMesh1": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"},
+ {"type": "GLint", "name": ["i1", "i2"]}
+ ],
+ "unimplemented": true
+ },
+ "EvalMesh2": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"},
+ {"type": "GLint", "name": ["i1", "i2", "j1", "j2"]}
+ ],
+ "unimplemented": true
+ },
+ "EvalPoint": {
+ "arguments": [
+ {"name": ["i", "j"]}
+ ],
+ "unimplemented": true,
+ "variants": {
+ "argument_counts": [1, 2],
+ "argument_defaults": ["0", "0"],
+ "types": {
+ "i": {}
+ }
+ }
+ },
+ "Finish": {},
+ "Flush": {},
+ "Fog": {
+ "arguments": [
+ {"type": "GLenum", "name": "pname"},
+ {"name": "param"}
+ ],
+ "variants": {
+ "argument_counts": [1],
+ "pointer_argument": "params",
+ "types": {
+ "f": {"implementation": "fogf"},
+ "fv": {"implementation": "fogfv"},
+ "i": {"implementation": "fogi"},
+ "iv": {"unimplemented": true}
+ }
+ }
+ },
+ "FrontFace": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"}
+ ]
+ },
+ "Frustum": {
+ "arguments": [
+ {"type": "GLdouble", "name": ["left", "right", "bottom", "top", "nearVal", "farVal"]}
+ ]
+ },
+ "GenBuffers": {
+ "arguments": [
+ {"type": "GLsizei", "name": "n"},
+ {"type": "GLuint*", "name": "buffers"}
+ ]
+ },
+ "GenLists": {
+ "arguments": [
+ {"type": "GLsizei", "name": "range"}
+ ],
+ "return_type": "GLuint"
+ },
+ "GenTextures": {
+ "arguments": [
+ {"type": "GLsizei", "name": "n"},
+ {"type": "GLuint*", "name": "textures"}
+ ]
+ },
+ "GetBooleanv": {
+ "arguments": [
+ {"type": "GLenum", "name": "pname"},
+ {"type": "GLboolean*", "name": "data"}
+ ]
+ },
+ "GetClipPlane": {
+ "arguments": [
+ {"type": "GLenum", "name": "plane"},
+ {"type": "GLdouble*", "name": "equation"}
+ ]
+ },
+ "GetDoublev": {
+ "arguments": [
+ {"type": "GLenum", "name": "pname"},
+ {"type": "GLdouble*", "name": "data"}
+ ]
+ },
+ "GetError": {
+ "return_type": "GLenum"
+ },
+ "GetFloatv": {
+ "arguments": [
+ {"type": "GLenum", "name": "pname"},
+ {"type": "GLfloat*", "name": "data"}
+ ]
+ },
+ "GetIntegerv": {
+ "arguments": [
+ {"type": "GLenum", "name": "pname"},
+ {"type": "GLint*", "name": "data"}
+ ]
+ },
+ "GetLight": {
+ "arguments": [
+ {"type": "GLenum", "name": "light"},
+ {"type": "GLenum", "name": "pname"},
+ {"name": "params"},
+ {"type": "GLenum", "expression": "@variant_gl_type@"}
+ ],
+ "variants": {
+ "argument_counts": [1],
+ "pointer_argument": "params",
+ "types": {
+ "fv!": {},
+ "iv!": {}
+ }
+ }
+ },
+ "GetMaterial": {
+ "arguments": [
+ {"type": "GLenum", "name": "face"},
+ {"type": "GLenum", "name": "pname"},
+ {"name": "params"},
+ {"type": "GLenum", "expression": "@variant_gl_type@"}
+ ],
+ "variants": {
+ "argument_counts": [1],
+ "pointer_argument": "params",
+ "types": {
+ "fv!": {},
+ "iv!": {}
+ }
+ }
+ },
+ "GetProgramiv": {
+ "arguments": [
+ {"type": "GLuint", "name": "program"},
+ {"type": "GLenum", "name": "pname"},
+ {"type": "GLint*", "name": "params"}
+ ],
+ "implementation": "get_program"
+ },
+ "GetShaderiv": {
+ "arguments": [
+ {"type": "GLuint", "name": "shader"},
+ {"type": "GLenum", "name": "pname"},
+ {"type": "GLint*", "name": "params"}
+ ],
+ "implementation": "get_shader"
+ },
+ "GetString": {
+ "arguments": [
+ {"type": "GLenum", "name": "name"}
+ ],
+ "return_type": "GLubyte const*"
+ },
+ "GetTexImage": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": "level"},
+ {"type": "GLenum", "name": ["format", "type"]},
+ {"type": "void*", "name": "pixels"}
+ ]
+ },
+ "GetTexLevelParameter": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": "level"},
+ {"type": "GLenum", "name": "pname"},
+ {"name": "params"}
+ ],
+ "variants": {
+ "argument_counts": [1],
+ "pointer_argument": "params",
+ "types": {
+ "fv!": {"unimplemented": true},
+ "iv!": {"implementation": "get_tex_parameter_integerv"}
+ }
+ }
+ },
+ "Hint": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLenum", "name": "mode"}
+ ]
+ },
+ "IsEnabled": {
+ "arguments": [
+ {"type": "GLenum", "name": "cap"}
+ ],
+ "return_type": "GLboolean"
+ },
+ "IsList": {
+ "arguments": [
+ {"type": "GLuint", "name": "list"}
+ ],
+ "return_type": "GLboolean"
+ },
+ "IsTexture": {
+ "arguments": [
+ {"type": "GLuint", "name": "texture"}
+ ],
+ "return_type": "GLboolean"
+ },
+ "Light": {
+ "arguments": [
+ {"type": "GLenum", "name": "light"},
+ {"type": "GLenum", "name": "pname"},
+ {"name": "param", "cast_to": "GLfloat"}
+ ],
+ "variants": {
+ "argument_counts": [1],
+ "pointer_argument": "params",
+ "types": {
+ "f": {},
+ "fv": {"implementation": "lightfv"},
+ "i": {},
+ "iv": {"implementation": "lightiv"},
+ "x": {},
+ "xv": {"implementation": "lightiv"}
+ }
+ },
+ "implementation": "lightf"
+ },
+ "LightModel": {
+ "arguments": [
+ {"type": "GLenum", "name": "pname"},
+ {"name": "param"},
+ {"type": "GLenum", "expression": "@variant_gl_type@"}
+ ],
+ "implementation": "light_modelv",
+ "variants": {
+ "argument_counts": [1],
+ "pointer_argument": "params",
+ "types": {
+ "fv": {},
+ "iv": {}
+ }
+ }
+ },
+ "LightModelf": {
+ "arguments": [
+ {"type": "GLenum", "name": "pname"},
+ {"type": "GLfloat", "name": "x"},
+ {"name": ["y", "z", "w"], "expression": "0.f"}
+ ],
+ "implementation": "light_model"
+ },
+ "LightModeli": {
+ "arguments": [
+ {"type": "GLenum", "name": "pname"},
+ {"type": "GLint", "name": "x", "cast_to": "GLfloat"},
+ {"name": ["y", "z", "w"], "expression": "0.f"}
+ ],
+ "implementation": "light_model"
+ },
+ "LineWidth": {
+ "arguments": [
+ {"type": "GLfloat", "name": "width"}
+ ]
+ },
+ "LinkProgram": {
+ "arguments": [
+ {"type": "GLuint", "name": "program"}
+ ]
+ },
+ "ListBase": {
+ "arguments": [
+ {"type": "GLuint", "name": "base"}
+ ]
+ },
+ "LoadIdentity": {},
+ "LoadMatrixd": {
+ "arguments": [
+ {"type": "GLdouble const*", "name": "m", "expression": "GL::transpose_input_matrix(@argument_name@)"}
+ ],
+ "implementation": "load_matrix"
+ },
+ "LoadMatrixf": {
+ "arguments": [
+ {"type": "GLfloat const*", "name": "m", "expression": "GL::transpose_input_matrix(@argument_name@)"}
+ ],
+ "implementation": "load_matrix"
+ },
+ "Map1d": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLdouble","name": ["u1", "u2"]},
+ {"type": "GLint", "name": ["stride", "order"]},
+ {"type": "GLdouble const*", "name": "points"}
+ ],
+ "unimplemented": true
+ },
+ "Map1f": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLfloat","name": ["u1", "u2"]},
+ {"type": "GLint", "name": ["stride", "order"]},
+ {"type": "GLfloat const*", "name": "points"}
+ ],
+ "unimplemented": true
+ },
+ "Map2d": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLdouble","name": ["u1", "u2"]},
+ {"type": "GLint", "name": ["ustride", "uorder"]},
+ {"type": "GLdouble","name": ["v1", "v2"]},
+ {"type": "GLint", "name": ["vstride", "vorder"]},
+ {"type": "GLdouble const*", "name": "points"}
+ ],
+ "unimplemented": true
+ },
+ "Map2f": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLfloat","name": ["u1", "u2"]},
+ {"type": "GLint", "name": ["ustride", "uorder"]},
+ {"type": "GLfloat","name": ["v1", "v2"]},
+ {"type": "GLint", "name": ["vstride", "vorder"]},
+ {"type": "GLfloat const*", "name": "points"}
+ ],
+ "unimplemented": true
+ },
+ "MapGrid1": {
+ "arguments": [
+ {"type": "GLint", "name": "un"},
+ {"name": ["u1", "u2"]}
+ ],
+ "unimplemented": true,
+ "variants": {
+ "types": {
+ "d": {},
+ "f": {}
+ }
+ }
+ },
+ "MapGrid2": {
+ "arguments": [
+ {"type": "GLint", "name": "un"},
+ {"name": ["u1", "u2"]},
+ {"type": "GLint", "name": "vn"},
+ {"name": ["v1", "v2"]}
+ ],
+ "unimplemented": true,
+ "variants": {
+ "types": {
+ "d": {},
+ "f": {}
+ }
+ }
+ },
+ "Material": {
+ "arguments": [
+ {"type": "GLenum", "name": "face"},
+ {"type": "GLenum", "name": "pname"},
+ {"name": "param", "cast_to": "GLfloat"}
+ ],
+ "implementation": "materialf",
+ "variants": {
+ "argument_counts": [1],
+ "pointer_argument": "params",
+ "types": {
+ "f": {},
+ "fv": {
+ "implementation": "materialfv"
+ },
+ "i": {},
+ "iv": {
+ "implementation": "materialiv"
+ }
+ }
+ }
+ },
+ "MatrixMode": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"}
+ ]
+ },
+ "MultiTexCoord": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"name": ["s", "t", "r", "q"], "cast_to": "GLfloat"}
+ ],
+ "variants": {
+ "api_suffixes": ["", "ARB"],
+ "argument_counts": [1, 2, 3, 4],
+ "argument_defaults": ["0.f", "0.f", "0.f", "1.f"],
+ "pointer_argument": "v",
+ "types": {
+ "d": {},
+ "dv": {},
+ "f": {},
+ "fv": {},
+ "i": {},
+ "iv": {},
+ "s": {},
+ "sv": {}
+ }
+ }
+ },
+ "MultMatrixd": {
+ "arguments": [
+ {"type": "GLdouble const*", "name": "m", "expression": "GL::transpose_input_matrix(@argument_name@)"}
+ ],
+ "implementation": "mult_matrix"
+ },
+ "MultMatrixf": {
+ "arguments": [
+ {"type": "GLfloat const*", "name": "m", "expression": "GL::transpose_input_matrix(@argument_name@)"}
+ ],
+ "implementation": "mult_matrix"
+ },
+ "NewList": {
+ "arguments": [
+ {"type": "GLuint", "name": "list"},
+ {"type": "GLenum", "name": "mode"}
+ ]
+ },
+ "Normal3": {
+ "arguments": [
+ {"name": ["nx", "ny", "nz"], "cast_to": "GLfloat"}
+ ],
+ "implementation": "normal",
+ "variants": {
+ "convert_range": true,
+ "pointer_argument": "v",
+ "types": {
+ "b": {},
+ "bv": {},
+ "d": {},
+ "dv": {},
+ "f": {},
+ "fv": {},
+ "i": {},
+ "iv": {},
+ "s": {},
+ "sv": {}
+ }
+ }
+ },
+ "NormalPointer": {
+ "arguments": [
+ {"type": "GLenum", "name": "type"},
+ {"type": "GLsizei", "name": "stride"},
+ {"type": "void const*", "name": "pointer"}
+ ]
+ },
+ "Ortho": {
+ "arguments": [
+ {"type": "GLdouble", "name": ["left", "right", "bottom", "top", "nearVal", "farVal"]}
+ ]
+ },
+ "PixelStore": {
+ "arguments": [
+ {"type": "GLenum", "name": "pname"},
+ {"name": "param", "cast_to": "GLint"}
+ ],
+ "implementation": "pixel_storei",
+ "variants": {
+ "types": {
+ "f": {},
+ "i": {}
+ }
+ }
+ },
+ "PointSize": {
+ "arguments": [
+ {"type": "GLfloat", "name": "size"}
+ ]
+ },
+ "PolygonMode": {
+ "arguments": [
+ {"type": "GLenum", "name": ["face", "mode"]}
+ ]
+ },
+ "PolygonOffset": {
+ "arguments": [
+ {"type": "GLfloat", "name": ["factor", "units"]}
+ ]
+ },
+ "PopAttrib": {},
+ "PopMatrix": {},
+ "PushAttrib": {
+ "arguments": [
+ {"type": "GLbitfield", "name": "mask"}
+ ]
+ },
+ "PushMatrix": {},
+ "RasterPos": {
+ "arguments": [
+ {"name": ["x", "y", "z", "w"], "cast_to": "GLfloat"}
+ ],
+ "variants": {
+ "argument_counts": [2, 3, 4],
+ "argument_defaults": ["0.f", "0.f", "0.f", "1.f"],
+ "pointer_argument": "v",
+ "types": {
+ "d": {},
+ "dv": {},
+ "f": {},
+ "fv": {},
+ "i": {},
+ "iv": {},
+ "s": {},
+ "sv": {}
+ }
+ }
+ },
+ "ReadBuffer": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"}
+ ]
+ },
+ "ReadPixels": {
+ "arguments": [
+ {"type": "GLint", "name": "x"},
+ {"type": "GLint", "name": "y"},
+ {"type": "GLsizei", "name": "width"},
+ {"type": "GLsizei", "name": "height"},
+ {"type": "GLenum", "name": "format"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "void*", "name": "data"}
+ ]
+ },
+ "Rect": {
+ "arguments": [
+ {"name": ["x1", "y1", "x2", "y2"], "cast_to": "GLdouble"}
+ ],
+ "variants": {
+ "types": {
+ "d": {},
+ "f": {},
+ "i": {},
+ "s": {}
+ }
+ }
+ },
+ "Rotate": {
+ "arguments": [
+ {"name": ["angle", "x", "y", "z"], "cast_to": "GLfloat"}
+ ],
+ "variants": {
+ "types": {
+ "d": {},
+ "f": {}
+ }
+ }
+ },
+ "Scale": {
+ "arguments": [
+ {"name": ["x", "y", "z"], "cast_to": "GLdouble"}
+ ],
+ "variants": {
+ "types": {
+ "d": {},
+ "f": {}
+ }
+ }
+ },
+ "Scissor": {
+ "arguments": [
+ {"type": "GLint", "name": ["x", "y"]},
+ {"type": "GLsizei", "name": ["width", "height"]}
+ ]
+ },
+ "ShadeModel": {
+ "arguments": [
+ {"type": "GLenum", "name": "mode"}
+ ]
+ },
+ "ShaderSource": {
+ "arguments": [
+ {"type": "GLuint", "name": "shader"},
+ {"type": "GLsizei", "name": "count"},
+ {"type": "GLchar const**", "name": "string"},
+ {"type": "GLint const*", "name": "length"}
+ ]
+ },
+ "StencilFunc": {
+ "arguments": [
+ {"expression": "GL_FRONT_AND_BACK"},
+ {"type": "GLenum", "name": "func"},
+ {"type": "GLint", "name": "ref"},
+ {"type": "GLuint", "name": "mask"}
+ ],
+ "implementation": "stencil_func_separate"
+ },
+ "StencilFuncSeparate": {
+ "arguments": [
+ {"type": "GLenum", "name": ["face", "func"]},
+ {"type": "GLint", "name": "ref"},
+ {"type": "GLuint", "name": "mask"}
+ ]
+ },
+ "StencilMask": {
+ "arguments": [
+ {"expression": "GL_FRONT_AND_BACK"},
+ {"type": "GLuint", "name": "mask"}
+ ],
+ "implementation": "stencil_mask_separate"
+ },
+ "StencilMaskSeparate": {
+ "arguments": [
+ {"type": "GLenum", "name": "face"},
+ {"type": "GLuint", "name": "mask"}
+ ]
+ },
+ "StencilOp": {
+ "arguments": [
+ {"expression": "GL_FRONT_AND_BACK"},
+ {"type": "GLenum", "name": ["sfail", "dpfail", "dppass"]}
+ ],
+ "implementation": "stencil_op_separate"
+ },
+ "StencilOpSeparate": {
+ "arguments": [
+ {"type": "GLenum", "name": ["face", "sfail", "dpfail", "dppass"]}
+ ]
+ },
+ "TexCoord": {
+ "arguments": [
+ {"name": ["s", "t", "r", "q"], "cast_to": "GLfloat"}
+ ],
+ "variants": {
+ "argument_counts": [1, 2, 3, 4],
+ "argument_defaults": ["0.f", "0.f", "0.f", "1.f"],
+ "pointer_argument": "v",
+ "types": {
+ "d": {},
+ "dv": {},
+ "f": {},
+ "fv": {},
+ "i": {},
+ "iv": {},
+ "s": {},
+ "sv": {}
+ }
+ }
+ },
+ "TexCoordPointer": {
+ "arguments": [
+ {"type": "GLint", "name": "size"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "GLsizei", "name": "stride"},
+ {"type": "void const*", "name": "pointer"}
+ ]
+ },
+ "TexEnv": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLenum", "name": "pname"},
+ {"name": "param", "cast_to": "GLfloat"}
+ ],
+ "variants": {
+ "pointer_argument": "params",
+ "types": {
+ "f": {},
+ "fv": {"unimplemented": true},
+ "i": {},
+ "iv": {"unimplemented": true}
+ }
+ }
+ },
+ "TexGen": {
+ "arguments": [
+ {"type": "GLenum", "name": "coord"},
+ {"type": "GLenum", "name": "pname"},
+ {"name": "param", "cast_to": "GLint"}
+ ],
+ "variants": {
+ "argument_counts": [1],
+ "pointer_argument": "params",
+ "types": {
+ "d": {},
+ "dv": {"unimplemented": true},
+ "f": {},
+ "fv": {"implementation": "tex_gen_floatv"},
+ "i": {},
+ "iv": {"unimplemented": true}
+ }
+ }
+ },
+ "TexImage1D": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": "level"},
+ {"type": "GLint", "name": "internalFormat"},
+ {"type": "GLsizei", "name": "width"},
+ {"type": "GLint", "name": "border"},
+ {"type": "GLenum", "name": "format"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "void const*", "name": "data"}
+ ],
+ "unimplemented": true
+ },
+ "TexImage2D": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": "level"},
+ {"type": "GLint", "name": "internalFormat"},
+ {"type": "GLsizei", "name": "width"},
+ {"type": "GLsizei", "name": "height"},
+ {"type": "GLint", "name": "border"},
+ {"type": "GLenum", "name": "format"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "void const*", "name": "data"}
+ ],
+ "implementation": "tex_image_2d"
+ },
+ "TexImage3D": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": "level"},
+ {"type": "GLint", "name": "internalFormat"},
+ {"type": "GLsizei", "name": "width"},
+ {"type": "GLsizei", "name": "height"},
+ {"type": "GLsizei", "name": "depth"},
+ {"type": "GLint", "name": "border"},
+ {"type": "GLenum", "name": "format"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "void const*", "name": "data"}
+ ],
+ "unimplemented": true
+ },
+ "TexParameter": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLenum", "name": "pname"},
+ {"name": "param"}
+ ],
+ "variants": {
+ "pointer_argument": "params",
+ "types": {
+ "f": {},
+ "fv": {"unimplemented": true},
+ "i": {},
+ "iv": {"unimplemented": true}
+ }
+ }
+ },
+ "TexSubImage1D": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": "level"},
+ {"type": "GLint", "name": "xoffset"},
+ {"type": "GLsizei", "name": "width"},
+ {"type": "GLenum", "name": "format"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "void const*", "name": "pixels"}
+ ],
+ "unimplemented": true
+ },
+ "TexSubImage2D": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": "level"},
+ {"type": "GLint", "name": "xoffset"},
+ {"type": "GLint", "name": "yoffset"},
+ {"type": "GLsizei", "name": "width"},
+ {"type": "GLsizei", "name": "height"},
+ {"type": "GLenum", "name": "format"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "void const*", "name": "pixels"}
+ ],
+ "implementation": "tex_sub_image_2d"
+ },
+ "TexSubImage3D": {
+ "arguments": [
+ {"type": "GLenum", "name": "target"},
+ {"type": "GLint", "name": "level"},
+ {"type": "GLint", "name": "xoffset"},
+ {"type": "GLint", "name": "yoffset"},
+ {"type": "GLint", "name": "zoffset"},
+ {"type": "GLsizei", "name": "width"},
+ {"type": "GLsizei", "name": "height"},
+ {"type": "GLsizei", "name": "depth"},
+ {"type": "GLenum", "name": "format"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "void const*", "name": "pixels"}
+ ],
+ "unimplemented": true
+ },
+ "Translate": {
+ "arguments": [
+ {"name": ["x", "y", "z"], "cast_to": "GLdouble"}
+ ],
+ "variants": {
+ "types": {
+ "d": {},
+ "f": {}
+ }
+ }
+ },
+ "UseProgram": {
+ "arguments": [
+ {"type": "GLuint", "name": "program"}
+ ]
+ },
+ "Vertex": {
+ "arguments": [
+ {"name": ["x", "y", "z", "w"], "cast_to": "GLdouble"}
+ ],
+ "variants": {
+ "argument_counts": [2, 3, 4],
+ "argument_defaults": ["0.", "0.", "0.", "1."],
+ "pointer_argument": "v",
+ "types": {
+ "d": {},
+ "dv": {},
+ "f": {},
+ "fv": {},
+ "i": {},
+ "iv": {},
+ "s": {},
+ "sv": {}
+ }
+ }
+ },
+ "VertexPointer": {
+ "arguments": [
+ {"type": "GLint", "name": "size"},
+ {"type": "GLenum", "name": "type"},
+ {"type": "GLsizei", "name": "stride"},
+ {"type": "void const*", "name": "pointer"}
+ ]
+ },
+ "Viewport": {
+ "arguments": [
+ {"type": "GLint", "name": ["x", "y"]},
+ {"type": "GLsizei", "name": ["width", "height"]}
+ ]
+ }
+}
diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h
index 259f4d88bc..3b1b1b27d1 100644
--- a/Userland/Libraries/LibGL/GLContext.h
+++ b/Userland/Libraries/LibGL/GLContext.h
@@ -574,6 +574,36 @@ private:
RefPtr<Buffer> m_element_array_buffer;
};
+// Transposes input matrices (column-major) to our Matrix (row-major).
+template<typename I>
+constexpr FloatMatrix4x4 transpose_input_matrix(I const* matrix)
+{
+ Array<float, 16> elements;
+ for (size_t i = 0; i < 16; ++i)
+ elements[i] = static_cast<float>(matrix[i]);
+ // clang-format off
+ return {
+ elements[0], elements[4], elements[8], elements[12],
+ elements[1], elements[5], elements[9], elements[13],
+ elements[2], elements[6], elements[10], elements[14],
+ elements[3], elements[7], elements[11], elements[15],
+ };
+ // clang-format on
+}
+
+template<>
+constexpr FloatMatrix4x4 transpose_input_matrix(float const* matrix)
+{
+ // clang-format off
+ return {
+ matrix[0], matrix[4], matrix[8], matrix[12],
+ matrix[1], matrix[5], matrix[9], matrix[13],
+ matrix[2], matrix[6], matrix[10], matrix[14],
+ matrix[3], matrix[7], matrix[11], matrix[15],
+ };
+ // clang-format on
+}
+
ErrorOr<NonnullOwnPtr<GLContext>> create_context(Gfx::Bitmap&);
void make_context_current(GLContext*);