diff options
author | Stephan Unverwerth <s.unverwerth@serenityos.org> | 2021-08-13 13:54:51 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-14 12:49:29 +0200 |
commit | f7764026323b3cd17374b4a34fe740be0c0e733e (patch) | |
tree | d5e7ef6022a47d035eb0d489962727d2733a3cd1 | |
parent | f52f40925ce891cdaac7c78ecec122f1003d87fe (diff) | |
download | serenity-f7764026323b3cd17374b4a34fe740be0c0e733e.zip |
LibGL: Implement glTexCoordPointer
-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/GLVertexArrays.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.h | 2 |
5 files changed, 25 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h index 08f1b584ae..d31959da45 100644 --- a/Userland/Libraries/LibGL/GL/gl.h +++ b/Userland/Libraries/LibGL/GL/gl.h @@ -359,6 +359,7 @@ GLAPI void glEnableClientState(GLenum cap); GLAPI void glDisableClientState(GLenum cap); GLAPI void glVertexPointer(GLint size, GLenum type, GLsizei stride, const void* pointer); GLAPI void glColorPointer(GLint size, GLenum type, GLsizei stride, const void* pointer); +GLAPI void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void* pointer); #ifdef __cplusplus } diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h index b1563fcc24..1cce1e5a6c 100644 --- a/Userland/Libraries/LibGL/GLContext.h +++ b/Userland/Libraries/LibGL/GLContext.h @@ -68,6 +68,7 @@ public: virtual void gl_disable_client_state(GLenum cap) = 0; virtual void gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) = 0; virtual void gl_color_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) = 0; + virtual void gl_tex_coord_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) = 0; virtual void present() = 0; }; diff --git a/Userland/Libraries/LibGL/GLVertexArrays.cpp b/Userland/Libraries/LibGL/GLVertexArrays.cpp index a34548b70d..8bf8e8d8cd 100644 --- a/Userland/Libraries/LibGL/GLVertexArrays.cpp +++ b/Userland/Libraries/LibGL/GLVertexArrays.cpp @@ -18,3 +18,8 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, const void* pointer { g_gl_context->gl_color_pointer(size, type, stride, pointer); } + +void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void* pointer) +{ + g_gl_context->gl_tex_coord_pointer(size, type, stride, pointer); +} diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index 75bcbabddd..cec7f28e9a 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -1485,6 +1485,22 @@ void SoftwareGLContext::gl_color_pointer(GLint size, GLenum type, GLsizei stride m_client_color_pointer.pointer = pointer; } +void SoftwareGLContext::gl_tex_coord_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) +{ + RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); + + RETURN_WITH_ERROR_IF(!(size == 1 || size == 2 || size == 3 || size == 4), GL_INVALID_VALUE); + + RETURN_WITH_ERROR_IF(!(type == GL_SHORT || type == GL_INT || type == GL_FLOAT || type == GL_DOUBLE), GL_INVALID_ENUM); + + RETURN_WITH_ERROR_IF(stride < 0, GL_INVALID_VALUE); + + m_client_tex_coord_pointer.size = size; + m_client_tex_coord_pointer.type = type; + m_client_tex_coord_pointer.stride = stride; + m_client_tex_coord_pointer.pointer = pointer; +} + void SoftwareGLContext::present() { m_rasterizer.blit_to(*m_frontbuffer); diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.h b/Userland/Libraries/LibGL/SoftwareGLContext.h index 45c472b05e..3fe4b2c783 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.h +++ b/Userland/Libraries/LibGL/SoftwareGLContext.h @@ -78,6 +78,7 @@ public: virtual void gl_disable_client_state(GLenum cap) override; virtual void gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) override; virtual void gl_color_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) override; + virtual void gl_tex_coord_pointer(GLint size, GLenum type, GLsizei stride, const void* pointer) override; virtual void present() override; @@ -235,6 +236,7 @@ private: VertexAttribPointer m_client_vertex_pointer; VertexAttribPointer m_client_color_pointer; + VertexAttribPointer m_client_tex_coord_pointer; }; } |