Page 1 of 1

Need help with simple RTT

Posted: Wed Jun 22, 2016 8:01 pm
by boyamer
Hi guys,
I'm porting http://www.ogre3d.org/tikiwiki/tiki-ind ... rceCurrent to Ogre 2.0, any expert can help me out please?
I tried but no success, read also the document but don't know how to proceed.

Thank you

Re: Need help with simple RTT

Posted: Fri Jun 24, 2016 7:27 pm
by xrgo
rtt in 2.X is very simple but very different than 1.X because of the new compositor system... I don't know about that tutorial but a simple code should be like this:

Code: Select all

    int width = 1280;
    int height = 720;

    Ogre::TexturePtr screenTexture0 = Ogre::TextureManager::getSingletonPtr()->createManual(
                "screenTexture0",
                Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                Ogre::TEX_TYPE_2D_ARRAY,
                width,
                height,
                0,
                Ogre::PF_R8G8B8,
                Ogre::TU_RENDERTARGET,
                0,
                false,
                0
            );

    Ogre::CompositorWorkspace* workspaceScreen0 = Ogre::Root::getSingletonPtr()->getCompositorManager2()->addWorkspace( mSceneManager, screenTexture0->getBuffer()->getRenderTarget(), mCamera, "WorkspaceDefinedSomewhereMaybeInAScript", true );

    pbsDatablock->setTexture( PBS_DIFFUSE, 0, screenTexture0 );
    myItem->setDatablock(pbsDatablock);