diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2022-05-01 01:37:09 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-05-05 20:50:14 +0200 |
commit | 4ace97c550c04041faf5276818e2e628bdbabdba (patch) | |
tree | 3e7f741ca1a76068d266aea95daac2760b99e883 | |
parent | 4054c35e9a9eca9b94c667331ed4af8ac2eb6638 (diff) | |
download | serenity-4ace97c550c04041faf5276818e2e628bdbabdba.zip |
LibGL: Put the OpenGL API wrapper in a single code unit
We were splitting these API wrappers up into different files without a
quantifiable benefit. Now, it's extremely clear where the direct API
implementation lives. :^)
-rw-r--r-- | Userland/Libraries/LibGL/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLAPI.cpp | 1055 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLBlend.cpp | 20 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLColor.cpp | 76 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLDraw.cpp | 37 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLFog.cpp | 25 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLLights.cpp | 117 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLLists.cpp | 50 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLMap.cpp | 106 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLMatrix.cpp | 143 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLStencil.cpp | 45 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLTexture.cpp | 118 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLUtils.cpp | 196 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLVert.cpp | 231 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLVertexArrays.cpp | 40 |
15 files changed, 1056 insertions, 1217 deletions
diff --git a/Userland/Libraries/LibGL/CMakeLists.txt b/Userland/Libraries/LibGL/CMakeLists.txt index 0aedebc0ca..b0347cbb4a 100644 --- a/Userland/Libraries/LibGL/CMakeLists.txt +++ b/Userland/Libraries/LibGL/CMakeLists.txt @@ -1,18 +1,6 @@ set(SOURCES - GLBlend.cpp - GLColor.cpp + GLAPI.cpp GLContext.cpp - GLDraw.cpp - GLFog.cpp - GLLights.cpp - GLLists.cpp - GLMap.cpp - GLMatrix.cpp - GLStencil.cpp - GLTexture.cpp - GLUtils.cpp - GLVert.cpp - GLVertexArrays.cpp Tex/NameAllocator.cpp Tex/Texture2D.cpp ) diff --git a/Userland/Libraries/LibGL/GLAPI.cpp b/Userland/Libraries/LibGL/GLAPI.cpp new file mode 100644 index 0000000000..61a4f804a4 --- /dev/null +++ b/Userland/Libraries/LibGL/GLAPI.cpp @@ -0,0 +1,1055 @@ +/* + * 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, typename O> +static constexpr Matrix4x4<O> transpose_input_matrix(I const* matrix) +{ + if constexpr (IsSame<I, O>) { + // 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 + } + + Array<O, 16> elements; + for (size_t i = 0; i < 16; ++i) + elements[i] = static_cast<O>(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 +} + +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 glBegin(GLenum mode) +{ + g_gl_context->gl_begin(mode); +} + +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 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 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); +} + +void glCullFace(GLenum mode) +{ + g_gl_context->gl_cull_face(mode); +} + +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 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* 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); +} + +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 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); +} + +GLubyte* glGetString(GLenum name) +{ + return g_gl_context->gl_get_string(name); +} + +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.0f, 0.0f, 0.0f); +} + +void glLightModelfv(GLenum pname, GLfloat const* params) +{ + switch (pname) { + case GL_LIGHT_MODEL_AMBIENT: + g_gl_context->gl_light_model(pname, params[0], params[1], params[2], params[3]); + break; + default: + g_gl_context->gl_light_model(pname, params[0], 0.0f, 0.0f, 0.0f); + break; + } +} + +void glLightModeliv(GLenum pname, GLint const* params) +{ + switch (pname) { + case GL_LIGHT_MODEL_AMBIENT: + g_gl_context->gl_light_model(pname, params[0], params[1], params[2], params[3]); + break; + default: + g_gl_context->gl_light_model(pname, params[0], 0.0f, 0.0f, 0.0f); + break; + } +} + +void glLightModeli(GLenum pname, GLint param) +{ + g_gl_context->gl_light_model(pname, param, 0.0f, 0.0f, 0.0f); +} + +void glLineWidth(GLfloat width) +{ + g_gl_context->gl_line_width(width); +} + +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<double, float>(matrix)); +} + +void glLoadMatrixf(GLfloat const* matrix) +{ + g_gl_context->gl_load_matrix(transpose_input_matrix<float, float>(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 glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t) +{ + g_gl_context->gl_multi_tex_coord(target, s, t, 0.0f, 1.0f); +} + +void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) +{ + glMultiTexCoord2f(target, s, t); +} + +void glMultMatrixd(GLdouble const* matrix) +{ + g_gl_context->gl_mult_matrix(transpose_input_matrix<double, float>(matrix)); +} + +void glMultMatrixf(GLfloat const* matrix) +{ + g_gl_context->gl_mult_matrix(transpose_input_matrix<float, float>(matrix)); +} + +void glNewList(GLuint list, GLenum mode) +{ + return g_gl_context->gl_new_list(list, mode); +} + +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) +{ + // FIXME: implement + dbgln_if(GL_DEBUG, "glPointSize({}): unimplemented", 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 glRasterPos2i(GLint x, GLint y) +{ + g_gl_context->gl_raster_pos(static_cast<float>(x), static_cast<float>(y), 0.0f, 1.0f); +} + +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 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 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/GLBlend.cpp b/Userland/Libraries/LibGL/GLBlend.cpp deleted file mode 100644 index 22d1ddf766..0000000000 --- a/Userland/Libraries/LibGL/GLBlend.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -void glBlendFunc(GLenum sfactor, GLenum dfactor) -{ - return g_gl_context->gl_blend_func(sfactor, dfactor); -} - -void glAlphaFunc(GLenum func, GLclampf ref) -{ - return g_gl_context->gl_alpha_func(func, ref); -} diff --git a/Userland/Libraries/LibGL/GLColor.cpp b/Userland/Libraries/LibGL/GLColor.cpp deleted file mode 100644 index 4eb277c919..0000000000 --- a/Userland/Libraries/LibGL/GLColor.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com> - * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org> - * Copyright (c) 2022, Jelle Raaijmakers <jelle@gmta.nl> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -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); -} diff --git a/Userland/Libraries/LibGL/GLDraw.cpp b/Userland/Libraries/LibGL/GLDraw.cpp deleted file mode 100644 index 9d16e42f44..0000000000 --- a/Userland/Libraries/LibGL/GLDraw.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021, Jelle Raaijmakers <jelle@gmta.nl> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" -#include <AK/Debug.h> - -extern GL::GLContext* g_gl_context; - -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 glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, void const* data) -{ - g_gl_context->gl_draw_pixels(width, height, format, type, data); -} - -void glLineWidth(GLfloat width) -{ - g_gl_context->gl_line_width(width); -} - -void glPointSize(GLfloat size) -{ - // FIXME: implement - dbgln_if(GL_DEBUG, "glPointSize({}): unimplemented", size); -} - -void glRasterPos2i(GLint x, GLint y) -{ - g_gl_context->gl_raster_pos(static_cast<float>(x), static_cast<float>(y), 0.0f, 1.0f); -} diff --git a/Userland/Libraries/LibGL/GLFog.cpp b/Userland/Libraries/LibGL/GLFog.cpp deleted file mode 100644 index 7f427f43dc..0000000000 --- a/Userland/Libraries/LibGL/GLFog.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -void glFogfv(GLenum pname, GLfloat* 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); -} diff --git a/Userland/Libraries/LibGL/GLLights.cpp b/Userland/Libraries/LibGL/GLLights.cpp deleted file mode 100644 index 5a797dfd4b..0000000000 --- a/Userland/Libraries/LibGL/GLLights.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org> - * Copyright (c) 2021, Jelle Raaijmakers <jelle@gmta.nl> - * Copyright (c) 2022, Jesse Buhagiar <jooster669@gmail.com> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" -#include <AK/Debug.h> - -extern GL::GLContext* g_gl_context; - -void glColorMaterial(GLenum face, GLenum mode) -{ - g_gl_context->gl_color_material(face, mode); -} - -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.0f, 0.0f, 0.0f); -} - -void glLightModelfv(GLenum pname, GLfloat const* params) -{ - switch (pname) { - case GL_LIGHT_MODEL_AMBIENT: - g_gl_context->gl_light_model(pname, params[0], params[1], params[2], params[3]); - break; - default: - g_gl_context->gl_light_model(pname, params[0], 0.0f, 0.0f, 0.0f); - break; - } -} - -void glLightModeliv(GLenum pname, GLint const* params) -{ - switch (pname) { - case GL_LIGHT_MODEL_AMBIENT: - g_gl_context->gl_light_model(pname, params[0], params[1], params[2], params[3]); - break; - default: - g_gl_context->gl_light_model(pname, params[0], 0.0f, 0.0f, 0.0f); - break; - } -} - -void glLightModeli(GLenum pname, GLint param) -{ - g_gl_context->gl_light_model(pname, param, 0.0f, 0.0f, 0.0f); -} - -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 glShadeModel(GLenum mode) -{ - g_gl_context->gl_shade_model(mode); -} - -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); -} diff --git a/Userland/Libraries/LibGL/GLLists.cpp b/Userland/Libraries/LibGL/GLLists.cpp deleted file mode 100644 index 5d901ba206..0000000000 --- a/Userland/Libraries/LibGL/GLLists.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -GLuint glGenLists(GLsizei range) -{ - return g_gl_context->gl_gen_lists(range); -} - -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 glDeleteLists(GLuint list, GLsizei range) -{ - return g_gl_context->gl_delete_lists(list, range); -} - -void glListBase(GLuint base) -{ - return g_gl_context->gl_list_base(base); -} - -void glEndList(void) -{ - return g_gl_context->gl_end_list(); -} - -void glNewList(GLuint list, GLenum mode) -{ - return g_gl_context->gl_new_list(list, mode); -} - -GLboolean glIsList(GLuint list) -{ - return g_gl_context->gl_is_list(list); -} diff --git a/Userland/Libraries/LibGL/GLMap.cpp b/Userland/Libraries/LibGL/GLMap.cpp deleted file mode 100644 index 8e228e56e9..0000000000 --- a/Userland/Libraries/LibGL/GLMap.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2021, Jelle Raaijmakers <jelle@gmta.nl> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -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 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(); -} diff --git a/Userland/Libraries/LibGL/GLMatrix.cpp b/Userland/Libraries/LibGL/GLMatrix.cpp deleted file mode 100644 index 8efa459155..0000000000 --- a/Userland/Libraries/LibGL/GLMatrix.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "AK/Array.h" -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -void glMatrixMode(GLenum mode) -{ - g_gl_context->gl_matrix_mode(mode); -} - -/* - * Push the current matrix (based on the current matrix mode) - * to its' corresponding matrix stack in the current OpenGL - * state context - */ -void glPushMatrix() -{ - g_gl_context->gl_push_matrix(); -} - -/* - * Pop a matrix from the corresponding matrix stack into the - * corresponding matrix in the state based on the current - * matrix mode - */ -void glPopMatrix() -{ - g_gl_context->gl_pop_matrix(); -} - -/* - * Transposes input matrices (column-major) to our Matrix (row-major). - */ -template<typename I, typename O> -static constexpr Matrix4x4<O> transpose_input_matrix(I const* matrix) -{ - if constexpr (IsSame<I, O>) { - // 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 - } - - Array<O, 16> elements; - for (size_t i = 0; i < 16; ++i) - elements[i] = static_cast<O>(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 -} - -void glMultMatrixd(GLdouble const* matrix) -{ - g_gl_context->gl_mult_matrix(transpose_input_matrix<double, float>(matrix)); -} - -void glMultMatrixf(GLfloat const* matrix) -{ - g_gl_context->gl_mult_matrix(transpose_input_matrix<float, float>(matrix)); -} - -void glLoadMatrixd(GLdouble const* matrix) -{ - g_gl_context->gl_load_matrix(transpose_input_matrix<double, float>(matrix)); -} - -void glLoadMatrixf(GLfloat const* matrix) -{ - g_gl_context->gl_load_matrix(transpose_input_matrix<float, float>(matrix)); -} - -void glLoadIdentity() -{ - g_gl_context->gl_load_identity(); -} - -/** - * Create a viewing frustum (a.k.a a "Perspective Matrix") in the current matrix. This - * is usually done to the projection matrix. The current matrix is then multiplied - * by this viewing frustum matrix. - * - * https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glFrustum.xml - * - * - * FIXME: We need to check for some values that could result in a division by zero - */ -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 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 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 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); -} diff --git a/Userland/Libraries/LibGL/GLStencil.cpp b/Userland/Libraries/LibGL/GLStencil.cpp deleted file mode 100644 index 7e2916ef08..0000000000 --- a/Userland/Libraries/LibGL/GLStencil.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2021, Jelle Raaijmakers <jelle@gmta.nl> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -void glClearStencil(GLint s) -{ - g_gl_context->gl_clear_stencil(s); -} - -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 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 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); -} diff --git a/Userland/Libraries/LibGL/GLTexture.cpp b/Userland/Libraries/LibGL/GLTexture.cpp deleted file mode 100644 index 7abaeaca92..0000000000 --- a/Userland/Libraries/LibGL/GLTexture.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com> - * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GLContext.h" -#include <LibGL/GL/gl.h> - -extern GL::GLContext* g_gl_context; - -void glGenTextures(GLsizei n, GLuint* textures) -{ - g_gl_context->gl_gen_textures(n, textures); -} - -void glDeleteTextures(GLsizei n, GLuint const* textures) -{ - g_gl_context->gl_delete_textures(n, textures); -} - -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 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 glBindTexture(GLenum target, GLuint texture) -{ - g_gl_context->gl_bind_texture(target, texture); -} - -GLboolean glIsTexture(GLuint texture) -{ - return g_gl_context->gl_is_texture(texture); -} - -void glActiveTextureARB(GLenum texture) -{ - glActiveTexture(texture); -} - -void glActiveTexture(GLenum texture) -{ - g_gl_context->gl_active_texture(texture); -} - -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 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 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 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 glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params) -{ - g_gl_context->gl_get_tex_parameter_integerv(target, level, pname, params); -} - -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); -} diff --git a/Userland/Libraries/LibGL/GLUtils.cpp b/Userland/Libraries/LibGL/GLUtils.cpp deleted file mode 100644 index ba76700151..0000000000 --- a/Userland/Libraries/LibGL/GLUtils.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com> - * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -void glEnable(GLenum cap) -{ - g_gl_context->gl_enable(cap); -} - -void glDisable(GLenum cap) -{ - g_gl_context->gl_disable(cap); -} - -GLboolean glIsEnabled(GLenum cap) -{ - return g_gl_context->gl_is_enabled(cap); -} - -void glFrontFace(GLenum mode) -{ - g_gl_context->gl_front_face(mode); -} - -void glCullFace(GLenum mode) -{ - g_gl_context->gl_cull_face(mode); -} - -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 glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -{ - g_gl_context->gl_color_mask(red, green, blue, alpha); -} - -GLubyte* glGetString(GLenum name) -{ - return g_gl_context->gl_get_string(name); -} - -void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) -{ - g_gl_context->gl_viewport(x, y, width, height); -} - -GLenum glGetError() -{ - return g_gl_context->gl_get_error(); -} - -void glFlush() -{ - g_gl_context->gl_flush(); -} - -void glFinish() -{ - g_gl_context->gl_finish(); -} - -void glHint(GLenum target, GLenum mode) -{ - g_gl_context->gl_hint(target, mode); -} - -void glReadBuffer(GLenum mode) -{ - g_gl_context->gl_read_buffer(mode); -} - -void glDrawBuffer(GLenum buffer) -{ - g_gl_context->gl_draw_buffer(buffer); -} - -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 glGetBooleanv(GLenum pname, GLboolean* data) -{ - g_gl_context->gl_get_booleanv(pname, data); -} - -void glGetDoublev(GLenum pname, GLdouble* params) -{ - g_gl_context->gl_get_doublev(pname, params); -} - -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 glDepthMask(GLboolean flag) -{ - g_gl_context->gl_depth_mask(flag); -} - -void glEnableClientState(GLenum cap) -{ - g_gl_context->gl_enable_client_state(cap); -} - -void glDisableClientState(GLenum cap) -{ - g_gl_context->gl_disable_client_state(cap); -} - -void glClientActiveTextureARB(GLenum target) -{ - glClientActiveTexture(target); -} - -void glClientActiveTexture(GLenum target) -{ - g_gl_context->gl_client_active_texture(target); -} - -void glDepthRange(GLdouble min, GLdouble max) -{ - g_gl_context->gl_depth_range(min, max); -} - -void glDepthFunc(GLenum func) -{ - g_gl_context->gl_depth_func(func); -} - -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 glPixelStorei(GLenum pname, GLint param) -{ - g_gl_context->gl_pixel_storei(pname, param); -} - -void glScissor(GLint x, GLint y, GLsizei width, GLsizei height) -{ - g_gl_context->gl_scissor(x, y, width, height); -} - -void glPushAttrib(GLbitfield mask) -{ - g_gl_context->gl_push_attrib(mask); -} - -void glPopAttrib() -{ - g_gl_context->gl_pop_attrib(); -} - -void glClipPlane(GLenum plane, GLdouble const* equation) -{ - g_gl_context->gl_clip_plane(plane, equation); -} diff --git a/Userland/Libraries/LibGL/GLVert.cpp b/Userland/Libraries/LibGL/GLVert.cpp deleted file mode 100644 index 1005a7f875..0000000000 --- a/Userland/Libraries/LibGL/GLVert.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com> - * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -void glBegin(GLenum mode) -{ - g_gl_context->gl_begin(mode); -} - -void glEnd() -{ - g_gl_context->gl_end(); -} - -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 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 glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) -{ - glMultiTexCoord2f(target, s, t); -} - -void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t) -{ - g_gl_context->gl_multi_tex_coord(target, s, t, 0.0f, 1.0f); -} - -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 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); -} diff --git a/Userland/Libraries/LibGL/GLVertexArrays.cpp b/Userland/Libraries/LibGL/GLVertexArrays.cpp deleted file mode 100644 index 985ba463b4..0000000000 --- a/Userland/Libraries/LibGL/GLVertexArrays.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "GL/gl.h" -#include "GLContext.h" - -extern GL::GLContext* g_gl_context; - -void glVertexPointer(GLint size, GLenum type, GLsizei stride, void const* pointer) -{ - g_gl_context->gl_vertex_pointer(size, type, stride, pointer); -} - -void glColorPointer(GLint size, GLenum type, GLsizei stride, void const* pointer) -{ - g_gl_context->gl_color_pointer(size, type, stride, pointer); -} - -void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, void const* pointer) -{ - g_gl_context->gl_tex_coord_pointer(size, type, stride, pointer); -} - -void glDrawArrays(GLenum mode, GLint first, GLsizei count) -{ - g_gl_context->gl_draw_arrays(mode, first, count); -} - -void glDrawElements(GLenum mode, GLsizei count, GLenum type, void const* indices) -{ - g_gl_context->gl_draw_elements(mode, count, type, indices); -} - -void glArrayElement(GLint i) -{ - g_gl_context->gl_array_element(i); -} |