LibGL: Implement the GL_LIGHTING parameter

This commit is contained in:
Jelle Raaijmakers 2021-12-01 22:18:40 +01:00 committed by Andreas Kling
parent b1ac181537
commit b89524c981
Notes: sideshowbarker 2024-07-17 22:50:38 +09:00
3 changed files with 13 additions and 0 deletions

View file

@ -178,6 +178,7 @@ extern "C" {
#define GL_RGBA 0x1908
// Lighting related defines
#define GL_LIGHTING 0x0B50
#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
#define GL_LIGHT_MODEL_AMBIENT 0x0B53

View file

@ -86,6 +86,8 @@ Optional<ContextParameter> SoftwareGLContext::get_context_parameter(GLenum name)
return ContextParameter { .type = GL_BOOL, .value = { .boolean_value = true } };
case GL_GREEN_BITS:
return ContextParameter { .type = GL_INT, .value = { .integer_value = sizeof(float) * 8 } };
case GL_LIGHTING:
return ContextParameter { .type = GL_BOOL, .value = { .boolean_value = m_lighting_enabled } };
case GL_MAX_TEXTURE_SIZE:
return ContextParameter { .type = GL_INT, .value = { .integer_value = 4096 } };
case GL_MAX_TEXTURE_UNITS:
@ -655,6 +657,9 @@ void SoftwareGLContext::gl_enable(GLenum capability)
rasterizer_options.fog_enabled = true;
update_rasterizer_options = true;
break;
case GL_LIGHTING:
m_lighting_enabled = true;
break;
case GL_SCISSOR_TEST:
rasterizer_options.scissor_enabled = true;
update_rasterizer_options = true;
@ -714,6 +719,9 @@ void SoftwareGLContext::gl_disable(GLenum capability)
rasterizer_options.fog_enabled = false;
update_rasterizer_options = true;
break;
case GL_LIGHTING:
m_lighting_enabled = false;
break;
case GL_SCISSOR_TEST:
rasterizer_options.scissor_enabled = false;
update_rasterizer_options = true;
@ -758,6 +766,8 @@ GLboolean SoftwareGLContext::gl_is_enabled(GLenum capability)
return m_alpha_test_enabled;
case GL_FOG:
return rasterizer_options.fog_enabled;
case GL_LIGHTING:
return m_lighting_enabled;
case GL_SCISSOR_TEST:
return rasterizer_options.scissor_enabled;
case GL_STENCIL_TEST:

View file

@ -357,6 +357,8 @@ private:
float m_line_width { 1.0f };
// Lighting configuration
bool m_lighting_enabled { false };
FloatVector4 m_light_model_ambient { 0.2f, 0.2f, 0.2f, 1.0f };
GLfloat m_light_model_two_side { 0.0f };
};