Need help with simple RTT

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
User avatar
boyamer
Orc
Posts: 459
Joined: Sat Jan 24, 2009 11:16 am
Location: Italy
x 6

Need help with simple RTT

Post 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
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 169

Re: Need help with simple RTT

Post 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);