1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:27:44 +00:00

LibGL: Implement glEnableClientState and glDisableClientState

This commit is contained in:
Stephan Unverwerth 2021-08-13 01:36:22 +02:00 committed by Andreas Kling
parent 5f863016ca
commit 886f154c2a
5 changed files with 65 additions and 0 deletions

View file

@ -354,6 +354,8 @@ GLAPI void glBindTexture(GLenum target, GLuint texture);
GLAPI void glActiveTexture(GLenum texture); GLAPI void glActiveTexture(GLenum texture);
GLAPI void glGetFloatv(GLenum pname, GLfloat* params); GLAPI void glGetFloatv(GLenum pname, GLfloat* params);
GLAPI void glDepthMask(GLboolean flag); GLAPI void glDepthMask(GLboolean flag);
GLAPI void glEnableClientState(GLenum cap);
GLAPI void glDisableClientState(GLenum cap);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -64,6 +64,8 @@ public:
virtual void gl_active_texture(GLenum texture) = 0; virtual void gl_active_texture(GLenum texture) = 0;
virtual void gl_get_floatv(GLenum pname, GLfloat* params) = 0; virtual void gl_get_floatv(GLenum pname, GLfloat* params) = 0;
virtual void gl_depth_mask(GLboolean flag) = 0; virtual void gl_depth_mask(GLboolean flag) = 0;
virtual void gl_enable_client_state(GLenum cap) = 0;
virtual void gl_disable_client_state(GLenum cap) = 0;
virtual void present() = 0; virtual void present() = 0;
}; };

View file

@ -94,3 +94,13 @@ void glDepthMask(GLboolean flag)
{ {
g_gl_context->gl_depth_mask(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);
}

View file

@ -1403,6 +1403,50 @@ void SoftwareGLContext::gl_depth_mask(GLboolean flag)
m_rasterizer.set_options(options); m_rasterizer.set_options(options);
} }
void SoftwareGLContext::gl_enable_client_state(GLenum cap)
{
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
switch (cap) {
case GL_VERTEX_ARRAY:
m_client_side_vertex_array_enabled = true;
break;
case GL_COLOR_ARRAY:
m_client_side_color_array_enabled = true;
break;
case GL_TEXTURE_COORD_ARRAY:
m_client_side_texture_coord_array_enabled = true;
break;
default:
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
}
}
void SoftwareGLContext::gl_disable_client_state(GLenum cap)
{
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
switch (cap) {
case GL_VERTEX_ARRAY:
m_client_side_vertex_array_enabled = false;
break;
case GL_COLOR_ARRAY:
m_client_side_color_array_enabled = false;
break;
case GL_TEXTURE_COORD_ARRAY:
m_client_side_texture_coord_array_enabled = false;
break;
default:
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
}
}
void SoftwareGLContext::present() void SoftwareGLContext::present()
{ {
m_rasterizer.blit_to(*m_frontbuffer); m_rasterizer.blit_to(*m_frontbuffer);

View file

@ -74,6 +74,8 @@ public:
virtual void gl_active_texture(GLenum texture) override; virtual void gl_active_texture(GLenum texture) override;
virtual void gl_get_floatv(GLenum pname, GLfloat* params) override; virtual void gl_get_floatv(GLenum pname, GLfloat* params) override;
virtual void gl_depth_mask(GLboolean flag) override; virtual void gl_depth_mask(GLboolean flag) override;
virtual void gl_enable_client_state(GLenum cap) override;
virtual void gl_disable_client_state(GLenum cap) override;
virtual void present() override; virtual void present() override;
@ -134,6 +136,11 @@ private:
GLenum m_current_read_buffer = GL_BACK; GLenum m_current_read_buffer = GL_BACK;
// Client side arrays
bool m_client_side_vertex_array_enabled = false;
bool m_client_side_color_array_enabled = false;
bool m_client_side_texture_coord_array_enabled = false;
NonnullRefPtr<Gfx::Bitmap> m_frontbuffer; NonnullRefPtr<Gfx::Bitmap> m_frontbuffer;
Clipper m_clipper; Clipper m_clipper;