mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:47:44 +00:00
LibGL: Ensure texture coordinate Q is set to 1 by default
When using vertex attribute pointers, we default the Q coordinate for textures to 0 causing issues if the 4th coordinate is not passed in the vertex data. Clean up these defaults and make sure that Q is always set to `1.f`.
This commit is contained in:
parent
af217b0c3a
commit
72782d845d
1 changed files with 9 additions and 9 deletions
|
@ -23,14 +23,14 @@ void GLContext::gl_array_element(GLint i)
|
|||
return;
|
||||
|
||||
if (m_client_side_color_array_enabled) {
|
||||
float color[4] { 0, 0, 0, 1 };
|
||||
float color[4] { 0.f, 0.f, 0.f, 1.f };
|
||||
read_from_vertex_attribute_pointer(m_client_color_pointer, i, color);
|
||||
gl_color(color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
for (size_t t = 0; t < m_client_tex_coord_pointer.size(); ++t) {
|
||||
if (m_client_side_texture_coord_array_enabled[t]) {
|
||||
float tex_coords[4] { 0, 0, 0, 0 };
|
||||
float tex_coords[4] { 0.f, 0.f, 0.f, 1.f };
|
||||
read_from_vertex_attribute_pointer(m_client_tex_coord_pointer[t], i, tex_coords);
|
||||
gl_multi_tex_coord(GL_TEXTURE0 + t, tex_coords[0], tex_coords[1], tex_coords[2], tex_coords[3]);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ void GLContext::gl_array_element(GLint i)
|
|||
gl_normal(normal[0], normal[1], normal[2]);
|
||||
}
|
||||
|
||||
float vertex[4] { 0, 0, 0, 1 };
|
||||
float vertex[4] { 0.f, 0.f, 0.f, 1.f };
|
||||
read_from_vertex_attribute_pointer(m_client_vertex_pointer, i, vertex);
|
||||
gl_vertex(vertex[0], vertex[1], vertex[2], vertex[3]);
|
||||
}
|
||||
|
@ -101,14 +101,14 @@ void GLContext::gl_draw_arrays(GLenum mode, GLint first, GLsizei count)
|
|||
gl_begin(mode);
|
||||
for (int i = first; i < last; i++) {
|
||||
if (m_client_side_color_array_enabled) {
|
||||
float color[4] { 0, 0, 0, 1 };
|
||||
float color[4] { 0.f, 0.f, 0.f, 1.f };
|
||||
read_from_vertex_attribute_pointer(m_client_color_pointer, i, color);
|
||||
gl_color(color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
for (size_t t = 0; t < m_client_tex_coord_pointer.size(); ++t) {
|
||||
if (m_client_side_texture_coord_array_enabled[t]) {
|
||||
float tex_coords[4] { 0, 0, 0, 0 };
|
||||
float tex_coords[4] { 0.f, 0.f, 0.f, 1.f };
|
||||
read_from_vertex_attribute_pointer(m_client_tex_coord_pointer[t], i, tex_coords);
|
||||
gl_multi_tex_coord(GL_TEXTURE0 + t, tex_coords[0], tex_coords[1], tex_coords[2], tex_coords[3]);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ void GLContext::gl_draw_arrays(GLenum mode, GLint first, GLsizei count)
|
|||
gl_normal(normal[0], normal[1], normal[2]);
|
||||
}
|
||||
|
||||
float vertex[4] { 0, 0, 0, 1 };
|
||||
float vertex[4] { 0.f, 0.f, 0.f, 1.f };
|
||||
read_from_vertex_attribute_pointer(m_client_vertex_pointer, i, vertex);
|
||||
gl_vertex(vertex[0], vertex[1], vertex[2], vertex[3]);
|
||||
}
|
||||
|
@ -168,14 +168,14 @@ void GLContext::gl_draw_elements(GLenum mode, GLsizei count, GLenum type, void c
|
|||
}
|
||||
|
||||
if (m_client_side_color_array_enabled) {
|
||||
float color[4] { 0, 0, 0, 1 };
|
||||
float color[4] { 0.f, 0.f, 0.f, 1.f };
|
||||
read_from_vertex_attribute_pointer(m_client_color_pointer, i, color);
|
||||
gl_color(color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
for (size_t t = 0; t < m_client_tex_coord_pointer.size(); ++t) {
|
||||
if (m_client_side_texture_coord_array_enabled[t]) {
|
||||
float tex_coords[4] { 0, 0, 0, 0 };
|
||||
float tex_coords[4] { 0.f, 0.f, 0.f, 1.f };
|
||||
read_from_vertex_attribute_pointer(m_client_tex_coord_pointer[t], i, tex_coords);
|
||||
gl_multi_tex_coord(GL_TEXTURE0 + t, tex_coords[0], tex_coords[1], tex_coords[2], tex_coords[3]);
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void GLContext::gl_draw_elements(GLenum mode, GLsizei count, GLenum type, void c
|
|||
gl_normal(normal[0], normal[1], normal[2]);
|
||||
}
|
||||
|
||||
float vertex[4] { 0, 0, 0, 1 };
|
||||
float vertex[4] { 0.f, 0.f, 0.f, 1.f };
|
||||
read_from_vertex_attribute_pointer(m_client_vertex_pointer, i, vertex);
|
||||
gl_vertex(vertex[0], vertex[1], vertex[2], vertex[3]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue