diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h index 876e9e5ae4..bcac8232ff 100644 --- a/Userland/Libraries/LibGL/GLContext.h +++ b/Userland/Libraries/LibGL/GLContext.h @@ -81,7 +81,7 @@ struct ContextParameter { struct VertexAttribPointer { GLint size { 4 }; GLenum type { GL_FLOAT }; - bool normalize { true }; + bool normalize; GLsizei stride { 0 }; void const* pointer { 0 }; }; diff --git a/Userland/Libraries/LibGL/Texture.cpp b/Userland/Libraries/LibGL/Texture.cpp index 4a20ca6a7e..300183d314 100644 --- a/Userland/Libraries/LibGL/Texture.cpp +++ b/Userland/Libraries/LibGL/Texture.cpp @@ -305,17 +305,6 @@ void GLContext::gl_tex_coord(GLfloat s, GLfloat t, GLfloat r, GLfloat q) m_current_vertex_tex_coord[0] = { s, t, r, q }; } -void GLContext::gl_tex_coord_pointer(GLint size, GLenum type, GLsizei stride, void const* 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); - - auto& tex_coord_pointer = m_client_tex_coord_pointer[m_client_active_texture]; - tex_coord_pointer = { .size = size, .type = type, .stride = stride, .pointer = pointer }; -} - void GLContext::gl_tex_env(GLenum target, GLenum pname, GLfloat param) { APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_tex_env, target, pname, param); diff --git a/Userland/Libraries/LibGL/Vertex.cpp b/Userland/Libraries/LibGL/Vertex.cpp index 62397c0f24..f7e5a91c3d 100644 --- a/Userland/Libraries/LibGL/Vertex.cpp +++ b/Userland/Libraries/LibGL/Vertex.cpp @@ -117,7 +117,7 @@ void GLContext::gl_color_pointer(GLint size, GLenum type, GLsizei stride, void c GL_INVALID_ENUM); RETURN_WITH_ERROR_IF(stride < 0, GL_INVALID_VALUE); - m_client_color_pointer = { .size = size, .type = type, .stride = stride, .pointer = pointer }; + m_client_color_pointer = { .size = size, .type = type, .normalize = true, .stride = stride, .pointer = pointer }; } void GLContext::gl_draw_arrays(GLenum mode, GLint first, GLsizei count) @@ -253,7 +253,18 @@ void GLContext::gl_normal_pointer(GLenum type, GLsizei stride, void const* point GL_INVALID_ENUM); RETURN_WITH_ERROR_IF(stride < 0, GL_INVALID_VALUE); - m_client_normal_pointer = { .size = 3, .type = type, .stride = stride, .pointer = pointer }; + m_client_normal_pointer = { .size = 3, .type = type, .normalize = true, .stride = stride, .pointer = pointer }; +} + +void GLContext::gl_tex_coord_pointer(GLint size, GLenum type, GLsizei stride, void const* 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); + + auto& tex_coord_pointer = m_client_tex_coord_pointer[m_client_active_texture]; + tex_coord_pointer = { .size = size, .type = type, .normalize = false, .stride = stride, .pointer = pointer }; } void GLContext::gl_vertex(GLdouble x, GLdouble y, GLdouble z, GLdouble w) @@ -278,7 +289,7 @@ void GLContext::gl_vertex_pointer(GLint size, GLenum type, GLsizei stride, void 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_vertex_pointer = { .size = size, .type = type, .stride = stride, .pointer = pointer }; + m_client_vertex_pointer = { .size = size, .type = type, .normalize = false, .stride = stride, .pointer = pointer }; } }