Skip to content

Commit

Permalink
Use C style cast to avoid precision downcast warning on gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
williamyang98 committed Sep 25, 2023
1 parent 5d592e7 commit 9b2821f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Texture::Texture(ImTextureID id, int width, int height)
{}

Texture::~Texture() {
const GLuint id = reinterpret_cast<GLuint>(m_id);
const GLuint id = GLuint(m_id);
glDeleteTextures(1, &id);
}

Expand Down Expand Up @@ -55,5 +55,5 @@ std::unique_ptr<Texture> Texture::LoadFromMemory(const uint8_t* data, const size
// stbi_set_flip_vertically_on_load(1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data);
stbi_image_free(image_data);
return std::make_unique<Texture>(reinterpret_cast<void*>(id), width, height);
return std::make_unique<Texture>((void*)(id), width, height);
}

0 comments on commit 9b2821f

Please sign in to comment.