Drawable Renderer (#1570), warnings

This commit is contained in:
Tim Sylvester
2023-04-27 15:29:18 -07:00
committed by Bart Louwers
parent b8c0b1a97c
commit 8a42b2fa5f
2 changed files with 9 additions and 5 deletions

View File

@@ -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<float>(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<float>(comp[0]/255.0),
static_cast<float>(comp[1]/255.0),
static_cast<float>(comp[2]/255.0),
static_cast<float>(comp[3]),
});
}
}

View File

@@ -116,7 +116,7 @@ const std::vector<std::uint8_t>& 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()));
}
}