Skip to content

Commit

Permalink
add BGR and BGRA
Browse files Browse the repository at this point in the history
  • Loading branch information
markaren committed Oct 7, 2024
1 parent ee19bbd commit e3aa5fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/threepp/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ namespace threepp {
Alpha,
RGB,
RGBA,
BGR,
BGRA,
Luminance,
LuminanceAlpha,
Depth,
Expand Down
2 changes: 1 addition & 1 deletion src/threepp/renderers/GLRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ struct GLRenderer::Impl {

auto& image = texture.image();
auto& data = image.data();
const auto newSize = image.width * image.height * (texture.format == Format::RGB ? 3 : 4);
const auto newSize = image.width * image.height * (texture.format == Format::RGB || texture.format == Format::BGR ? 3 : 4);
data.resize(newSize);

glGetTexImage(GL_TEXTURE_2D, 0, gl::toGLFormat(texture.format), gl::toGLType(texture.type), data.data());
Expand Down

0 comments on commit e3aa5fa

Please sign in to comment.