From 8a42b2fa5f342174a557c52830d5994184d9f9cf Mon Sep 17 00:00:00 2001 From: Tim Sylvester Date: Thu, 27 Apr 2023 15:29:18 -0700 Subject: [PATCH] Drawable Renderer (#1570), warnings --- src/mbgl/gl/drawable_gl_builder.cpp | 10 +++++++--- src/mbgl/gl/vertex_attribute_gl.cpp | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mbgl/gl/drawable_gl_builder.cpp b/src/mbgl/gl/drawable_gl_builder.cpp index fb329408d..843e2abf3 100644 --- a/src/mbgl/gl/drawable_gl_builder.cpp +++ b/src/mbgl/gl/drawable_gl_builder.cpp @@ -24,9 +24,13 @@ void DrawableGLBuilder::init() { if (auto colorAttr = attrs.getOrAdd("a_color")) { std::size_t index = 0; for (const auto& color : impl->colors) { - const auto comp = util::convert(color.toArray()); - const auto norm = gfx::VertexAttribute::float4{comp[0]/255.f,comp[1]/255.f,comp[2]/255.f,comp[3]}; - colorAttr->set(index++, norm); + const auto comp = color.toArray(); + colorAttr->set(index++, gfx::VertexAttribute::float4 { + static_cast(comp[0]/255.0), + static_cast(comp[1]/255.0), + static_cast(comp[2]/255.0), + static_cast(comp[3]), + }); } } diff --git a/src/mbgl/gl/vertex_attribute_gl.cpp b/src/mbgl/gl/vertex_attribute_gl.cpp index efbe52775..e8f7affbc 100644 --- a/src/mbgl/gl/vertex_attribute_gl.cpp +++ b/src/mbgl/gl/vertex_attribute_gl.cpp @@ -116,7 +116,7 @@ const std::vector& VertexAttributeGL::getRaw(platform::GLenum type std::fill(rawData.begin(), rawData.end(), 0); if (!rawData.empty()) { - std::uint8_t* outPtr = &rawData[0]; + std::uint8_t* outPtr = rawData.data(); for (std::size_t i = 0; i < count; ++i) { if (!get(items[i], type, outPtr)) { // throw? @@ -143,7 +143,7 @@ namespace { template <> void applyUniform(GLint, const gfx::VertexAttribute::float4& ) { } template <> void applyUniform(GLint, const gfx::VertexAttribute::matf3& ) { } template <> void applyUniform(GLint location, const gfx::VertexAttribute::matf4& value) { - MBGL_CHECK_ERROR(glUniformMatrix4fv(location, 1, GL_FALSE, &value[0])); + MBGL_CHECK_ERROR(glUniformMatrix4fv(location, 1, GL_FALSE, value.data())); } }