diff options
author | Jesse Buhagiar <jooster669@gmail.com> | 2021-05-23 20:38:18 +1000 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-05-26 16:36:53 +0430 |
commit | e21ba0cd122b9b61c8d2caef3eb13ed9a478682f (patch) | |
tree | 3a29151d8e749b7cc9a72eed05aba9cfc2be9c95 /Userland/Libraries/LibGL | |
parent | 4f324ba4d720f4d03ea6d25c9333089b6968495a (diff) | |
download | serenity-e21ba0cd122b9b61c8d2caef3eb13ed9a478682f.zip |
LibGL: Implement glTexCoord2f
Diffstat (limited to 'Userland/Libraries/LibGL')
-rw-r--r-- | Userland/Libraries/LibGL/GL/gl.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLContext.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/GLVert.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.cpp | 11 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.h | 1 |
5 files changed, 19 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h index 4852eb35cf..c7fd7856c9 100644 --- a/Userland/Libraries/LibGL/GL/gl.h +++ b/Userland/Libraries/LibGL/GL/gl.h @@ -256,6 +256,7 @@ GLAPI void glHint(GLenum target, GLenum mode); GLAPI void glReadBuffer(GLenum mode); GLAPI void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); GLAPI void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data); +GLAPI void glTexCoord2f(GLfloat s, GLfloat t); #ifdef __cplusplus } diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h index 217bf96f25..44e551751d 100644 --- a/Userland/Libraries/LibGL/GLContext.h +++ b/Userland/Libraries/LibGL/GLContext.h @@ -58,6 +58,7 @@ public: virtual void gl_read_buffer(GLenum mode) = 0; virtual void gl_read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) = 0; virtual void gl_tex_image_2d(GLenum target, GLint level, GLint internal_format, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data) = 0; + virtual void gl_tex_coord(GLfloat s, GLfloat t, GLfloat r, GLfloat q) = 0; virtual void present() = 0; }; diff --git a/Userland/Libraries/LibGL/GLVert.cpp b/Userland/Libraries/LibGL/GLVert.cpp index 3afdf36757..ab3ed82ff1 100644 --- a/Userland/Libraries/LibGL/GLVert.cpp +++ b/Userland/Libraries/LibGL/GLVert.cpp @@ -140,6 +140,11 @@ void glVertex4sv(const GLshort* v) g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]); } +void glTexCoord2f(GLfloat s, GLfloat t) +{ + g_gl_context->gl_tex_coord(s, t, 0.0f, 0.0f); +} + void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { g_gl_context->gl_rotate(angle, x, y, z); diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index 9333ebba66..567cc2ddc7 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -646,6 +646,17 @@ void SoftwareGLContext::gl_vertex(GLdouble x, GLdouble y, GLdouble z, GLdouble w m_error = GL_NO_ERROR; } +// FIXME: We need to add `r` and `q` to our GLVertex?! +void SoftwareGLContext::gl_tex_coord(GLfloat s, GLfloat t, GLfloat, GLfloat) +{ + auto& vertex = vertex_list.last(); // Get the last created vertex + + vertex.u = s; + vertex.v = t; + + m_error = GL_NO_ERROR; +} + void SoftwareGLContext::gl_viewport(GLint x, GLint y, GLsizei width, GLsizei height) { APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_viewport, x, y, width, height); diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.h b/Userland/Libraries/LibGL/SoftwareGLContext.h index 6ac6b599c4..3e150bead9 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.h +++ b/Userland/Libraries/LibGL/SoftwareGLContext.h @@ -67,6 +67,7 @@ public: virtual void gl_read_buffer(GLenum mode) override; virtual void gl_read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) override; virtual void gl_tex_image_2d(GLenum target, GLint level, GLint internal_format, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data) override; + virtual void gl_tex_coord(GLfloat s, GLfloat t, GLfloat r, GLfloat q) override; virtual void present() override; |