summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibGL/GL/gl.h1
-rw-r--r--Userland/Libraries/LibGL/GLContext.h1
-rw-r--r--Userland/Libraries/LibGL/GLDraw.cpp5
-rw-r--r--Userland/Libraries/LibGL/SoftwareGLContext.cpp9
-rw-r--r--Userland/Libraries/LibGL/SoftwareGLContext.h6
5 files changed, 21 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h
index 8c5674bd96..64b037a471 100644
--- a/Userland/Libraries/LibGL/GL/gl.h
+++ b/Userland/Libraries/LibGL/GL/gl.h
@@ -467,6 +467,7 @@ GLAPI void glNormal3fv(GLfloat const* v);
GLAPI void glRasterPos2i(GLint x, GLint y);
GLAPI void glMaterialf(GLenum face, GLenum pname, GLfloat param);
GLAPI void glMaterialfv(GLenum face, GLenum pname, GLfloat const* params);
+GLAPI void glLineWidth(GLfloat width);
#ifdef __cplusplus
}
diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h
index 42f392908d..58b7281cd7 100644
--- a/Userland/Libraries/LibGL/GLContext.h
+++ b/Userland/Libraries/LibGL/GLContext.h
@@ -98,6 +98,7 @@ public:
virtual void gl_normal(GLfloat nx, GLfloat ny, GLfloat nz) = 0;
virtual void gl_raster_pos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) = 0;
virtual void gl_materialv(GLenum face, GLenum pname, GLfloat const* params) = 0;
+ virtual void gl_line_width(GLfloat width) = 0;
virtual void present() = 0;
};
diff --git a/Userland/Libraries/LibGL/GLDraw.cpp b/Userland/Libraries/LibGL/GLDraw.cpp
index 102013867b..5be277a741 100644
--- a/Userland/Libraries/LibGL/GLDraw.cpp
+++ b/Userland/Libraries/LibGL/GLDraw.cpp
@@ -9,6 +9,11 @@
extern GL::GLContext* g_gl_context;
+void glLineWidth(GLfloat width)
+{
+ g_gl_context->gl_line_width(width);
+}
+
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/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
index 48a3faadc4..675751cb5c 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
@@ -2318,6 +2318,15 @@ void SoftwareGLContext::gl_materialv(GLenum face, GLenum pname, GLfloat const* p
dbgln_if(GL_DEBUG, "SoftwareGLContext FIXME: gl_materialv({}, {}, {}, {}, {}, {})", face, pname, x, y, z, w);
}
+void SoftwareGLContext::gl_line_width(GLfloat width)
+{
+ APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_line_width, width);
+
+ RETURN_WITH_ERROR_IF(width <= 0, GL_INVALID_VALUE);
+
+ m_line_width = width;
+}
+
void SoftwareGLContext::present()
{
m_rasterizer.blit_to(*m_frontbuffer);
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.h b/Userland/Libraries/LibGL/SoftwareGLContext.h
index 19342056de..8474cb425d 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.h
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.h
@@ -109,6 +109,7 @@ public:
virtual void gl_normal(GLfloat nx, GLfloat ny, GLfloat nz) override;
virtual void gl_raster_pos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) override;
virtual void gl_materialv(GLenum face, GLenum pname, GLfloat const* params) override;
+ virtual void gl_line_width(GLfloat width) override;
virtual void present() override;
private:
@@ -278,7 +279,8 @@ private:
decltype(&SoftwareGLContext::gl_stencil_op_separate),
decltype(&SoftwareGLContext::gl_normal),
decltype(&SoftwareGLContext::gl_raster_pos),
- decltype(&SoftwareGLContext::gl_materialv)>;
+ decltype(&SoftwareGLContext::gl_materialv),
+ decltype(&SoftwareGLContext::gl_line_width)>;
using ExtraSavedArguments = Variant<
FloatMatrix4x4>;
@@ -325,6 +327,8 @@ private:
FloatVector4 texture_coordinates { 0.0f, 0.0f, 0.0f, 1.0f };
};
RasterPosition m_current_raster_position;
+
+ float m_line_width { 1.0f };
};
}