Thanks for confirming.
I have scrapped the RenderWindow as I just need an offscreen Render Texture. However, Ogre's writeContentsToFile is just outputting a completely transparent texture.
This snippet creates the render texture and adds the workspace:
Code: Select all
texture = textureManager->createTexture("RTex", "RTex",
Ogre::GpuPageOutStrategy::Discard,
Ogre::TextureFlags::RenderToTexture,
Ogre::TextureTypes::Type2D);
texture->setPixelFormat(Ogre::PixelFormatGpu::PFG_RGBA8_UNORM);
texture->setResolution(1024, 1024);
texture->scheduleTransitionTo(Ogre::GpuResidency::Resident);
workspace = compositorManager->addWorkspace( sceneManager, texture, camera, "WorkspaceTest", true );
And here I get the completely transparent image from writeContentsToFile.
I assume I am missing something here:
(apologies if it is something simple)
Code: Select all
ogreRoot->renderOneFrame();
// Also tried this from an older thread in this forum
/*
workspace->_beginUpdate( true );
workspace->_update();
workspace->_endUpdate( true );
*/
workspace->getFinalTarget()->writeContentsToFile("output.png", 0, 0);