I am trying to save a texture with pixel format PFG_R32_FLOAT to file, but it crash. If I change the format to PFG_RGBA8_UNORM, it works fine. I think I am missing something, but I can't find what. The code is:
Code: Select all
Ogre::TextureGpu* displaceTex = <a_valid_gpu_texture>
Ogre::Image2 image;
image.convertFromTexture( displaceTex, 0, 0 );
Ogre::Image2 img2dView;
img2dView.loadDynamicImage( image.getData( 0 ).atFromOffsettedOrigin( 0, 0, 0 ),
image.getWidth(), image.getHeight(), image.getDepthOrSlices(),
Ogre::TextureTypes::Type2D, image.getPixelFormat(), // <---- image pixel format is Ogre::PixelFormatGpu::PFG_R32_FLOAT. If here I change manually to PFG_RGBA8_UNORM the save works.
false, 1u );
img2dView.save( "./Captures/test.png", 0, 0 ); //<---- crash here
Thanks!