diff options
Diffstat (limited to 'Userland/Libraries/LibGL')
-rw-r--r-- | Userland/Libraries/LibGL/ContextParameter.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GL/gl.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLAPI.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLContext.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLContext.h | 10 |
5 files changed, 24 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGL/ContextParameter.cpp b/Userland/Libraries/LibGL/ContextParameter.cpp index cdb355a838..2457a1c850 100644 --- a/Userland/Libraries/LibGL/ContextParameter.cpp +++ b/Userland/Libraries/LibGL/ContextParameter.cpp @@ -78,6 +78,8 @@ Optional<ContextParameter> GLContext::get_context_parameter(GLenum name) return ContextParameter { .type = GL_INT, .value = { .integer_value = 0 } }; case GL_PACK_SWAP_BYTES: return ContextParameter { .type = GL_BOOL, .value = { .boolean_value = false } }; + case GL_POINT_SIZE: + return ContextParameter { .type = GL_DOUBLE, .value = { .double_value = static_cast<GLdouble>(m_point_size) } }; case GL_POLYGON_OFFSET_FILL: return ContextParameter { .type = GL_BOOL, .is_capability = true, .value = { .boolean_value = m_depth_offset_enabled } }; case GL_RED_BITS: diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h index 7824f41b99..896526dcdd 100644 --- a/Userland/Libraries/LibGL/GL/gl.h +++ b/Userland/Libraries/LibGL/GL/gl.h @@ -301,6 +301,7 @@ extern "C" { // Points #define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 #define GL_POINT_SIZE_MIN_EXT 0x8126 #define GL_POINT_SIZE_MAX_EXT 0x8127 #define GL_DISTANCE_ATTENUATION_EXT 0x8129 diff --git a/Userland/Libraries/LibGL/GLAPI.cpp b/Userland/Libraries/LibGL/GLAPI.cpp index 61a4f804a4..68f5da4e05 100644 --- a/Userland/Libraries/LibGL/GLAPI.cpp +++ b/Userland/Libraries/LibGL/GLAPI.cpp @@ -673,8 +673,7 @@ void glPixelStorei(GLenum pname, GLint param) void glPointSize(GLfloat size) { - // FIXME: implement - dbgln_if(GL_DEBUG, "glPointSize({}): unimplemented", size); + g_gl_context->gl_point_size(size); } void glPolygonMode(GLenum face, GLenum mode) diff --git a/Userland/Libraries/LibGL/GLContext.cpp b/Userland/Libraries/LibGL/GLContext.cpp index 77f70936cc..4e5f0ff436 100644 --- a/Userland/Libraries/LibGL/GLContext.cpp +++ b/Userland/Libraries/LibGL/GLContext.cpp @@ -1192,6 +1192,18 @@ void GLContext::gl_rect(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) gl_end(); } +void GLContext::gl_point_size(GLfloat size) +{ + APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_point_size, size); + RETURN_WITH_ERROR_IF(size <= 0.f, GL_INVALID_VALUE); + + m_point_size = size; + + auto rasterizer_options = m_rasterizer->options(); + rasterizer_options.point_size = size; + m_rasterizer->set_options(rasterizer_options); +} + void GLContext::present() { m_rasterizer->blit_color_buffer_to(*m_frontbuffer); diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h index 8ed5b14ee6..9093a414be 100644 --- a/Userland/Libraries/LibGL/GLContext.h +++ b/Userland/Libraries/LibGL/GLContext.h @@ -199,6 +199,7 @@ public: void gl_clip_plane(GLenum plane, GLdouble const* equation); void gl_array_element(GLint i); void gl_copy_tex_sub_image_2d(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void gl_point_size(GLfloat size); private: void sync_device_config(); @@ -442,7 +443,8 @@ private: decltype(&GLContext::gl_get_light), decltype(&GLContext::gl_clip_plane), decltype(&GLContext::gl_array_element), - decltype(&GLContext::gl_copy_tex_sub_image_2d)>; + decltype(&GLContext::gl_copy_tex_sub_image_2d), + decltype(&GLContext::gl_point_size)>; using ExtraSavedArguments = Variant< FloatMatrix4x4>; @@ -481,7 +483,11 @@ private: GLsizei m_unpack_row_length { 0 }; u8 m_unpack_alignment { 4 }; - float m_line_width { 1.0f }; + // Point drawing configuration + float m_point_size { 1.f }; + + // Line drawing configuration + float m_line_width { 1.f }; // Lighting configuration bool m_lighting_enabled { false }; |