diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2022-09-06 23:12:25 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-11 22:37:07 +0100 |
commit | 72782d845dc88ae0451a96b6def5e00415c9f835 (patch) | |
tree | 135cacb197dd4e03d70986f9ca8e3b73008f08fa /Userland/Libraries/LibGL/Vertex.cpp | |
parent | af217b0c3a4483a74d7c55778dcfd9b8fa9401c3 (diff) | |
download | serenity-72782d845dc88ae0451a96b6def5e00415c9f835.zip |
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`.
Diffstat (limited to 'Userland/Libraries/LibGL/Vertex.cpp')
-rw-r--r-- | Userland/Libraries/LibGL/Vertex.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Userland/Libraries/LibGL/Vertex.cpp b/Userland/Libraries/LibGL/Vertex.cpp index e6bb923b74..5e5308fd92 100644 --- a/Userland/Libraries/LibGL/Vertex.cpp +++ b/Userland/Libraries/LibGL/Vertex.cpp @@ -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]); } |