1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:57:44 +00:00

LibGL: Fix glTexCoord behaviour

glTexCoord should behave like glColor. It only updates a gl context
variable that contains the current texture coordinates. The vertex is
only actually created once glVertex is called.
This commit is contained in:
Stephan Unverwerth 2021-08-16 15:13:19 +02:00 committed by Andreas Kling
parent b6373c2aba
commit 5e27da20f4
3 changed files with 11 additions and 11 deletions

View file

@ -555,19 +555,18 @@ void SoftwareGLContext::gl_vertex(GLdouble x, GLdouble y, GLdouble z, GLdouble w
// FIXME: This is to suppress any -Wunused errors
vertex.w = 0.0f;
vertex.u = 0.0f;
vertex.v = 0.0f;
vertex.u = m_current_vertex_tex_coord.x();
vertex.v = m_current_vertex_tex_coord.y();
vertex_list.append(vertex);
}
// FIXME: We need to add `r` and `q` to our GLVertex?!
void SoftwareGLContext::gl_tex_coord(GLfloat s, GLfloat t, GLfloat, GLfloat)
void SoftwareGLContext::gl_tex_coord(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
{
auto& vertex = vertex_list.last(); // Get the last created vertex
APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_tex_coord, s, t, r, q);
vertex.u = s;
vertex.v = t;
m_current_vertex_tex_coord = { s, t, r, q };
}
void SoftwareGLContext::gl_viewport(GLint x, GLint y, GLsizei width, GLsizei height)

View file

@ -119,6 +119,7 @@ private:
FloatVector4 m_clear_color = { 0.0f, 0.0f, 0.0f, 0.0f };
double m_clear_depth = { 1.0 };
FloatVector4 m_current_vertex_color = { 1.0f, 1.0f, 1.0f, 1.0f };
FloatVector4 m_current_vertex_tex_coord = { 0.0f, 0.0f, 0.0f, 0.0f };
Vector<GLVertex, 96> vertex_list;
Vector<GLTriangle, 32> triangle_list;