From 07e94b3ec16ace890e8ef394f982512d5f4d9c1f Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Sun, 4 Sep 2022 16:46:23 +0200 Subject: [PATCH] LibGL: Implement `GL_CURRENT_COLOR` context parameter --- Userland/Libraries/LibGL/ContextParameter.cpp | 12 ++++++++++++ Userland/Libraries/LibGL/GL/gl.h | 1 + 2 files changed, 13 insertions(+) diff --git a/Userland/Libraries/LibGL/ContextParameter.cpp b/Userland/Libraries/LibGL/ContextParameter.cpp index 0598e1d2cf..b08687d611 100644 --- a/Userland/Libraries/LibGL/ContextParameter.cpp +++ b/Userland/Libraries/LibGL/ContextParameter.cpp @@ -32,6 +32,18 @@ Optional GLContext::get_context_parameter(GLenum name) return ContextParameter { .type = GL_INT, .value = { .integer_value = static_cast(m_color_material_face) } }; case GL_COLOR_MATERIAL_MODE: return ContextParameter { .type = GL_INT, .value = { .integer_value = static_cast(m_color_material_mode) } }; + case GL_CURRENT_COLOR: + return ContextParameter { + .type = GL_DOUBLE, + .count = 4, + .value = { + .double_list = { + static_cast(m_current_vertex_color.x()), + static_cast(m_current_vertex_color.y()), + static_cast(m_current_vertex_color.z()), + static_cast(m_current_vertex_color.w()), + } } + }; case GL_CULL_FACE: return ContextParameter { .type = GL_BOOL, .is_capability = true, .value = { .boolean_value = m_cull_faces } }; case GL_DEPTH_BITS: diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h index 9d1afa1f71..db137c8a4b 100644 --- a/Userland/Libraries/LibGL/GL/gl.h +++ b/Userland/Libraries/LibGL/GL/gl.h @@ -96,6 +96,7 @@ extern "C" { #define GL_SHADING_LANGUAGE_VERSION 0x8B8C // Get parameters +#define GL_CURRENT_COLOR 0x0B00 #define GL_COLOR_MATERIAL_FACE 0x0B55 #define GL_COLOR_MATERIAL_MODE 0x0B56 #define GL_COLOR_MATERIAL 0x0B57