Skip to content

Commit

Permalink
Fix use of srgb format for texture map data (#931)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 authored Oct 4, 2023
1 parent 93841e1 commit 5892355
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ogre2/src/Ogre2Material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1229,8 +1229,10 @@ void Ogre2Material::SetTextureMapDataImpl(const std::string& _name,
if (texture->getWidth() == 0)
{
auto data = _img->RGBAData();

texture->setPixelFormat(Ogre::PFG_RGBA8_UNORM_SRGB);
Ogre::PixelFormatGpu format = Ogre::PFG_RGBA8_UNORM;
if (this->ogreDatablock->suggestUsingSRGB(_type))
format = Ogre::PFG_RGBA8_UNORM_SRGB;
texture->setPixelFormat(format);
texture->setTextureType(Ogre::TextureTypes::Type2D);
texture->setNumMipmaps(1u);
texture->setResolution(_img->Width(), _img->Height());
Expand Down

0 comments on commit 5892355

Please sign in to comment.