CEGUI+Ogre: Render to Texture Question

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

madcoma
Just popping in
Just popping in
Posts: 1
Joined: Tue Dec 14, 2010 10:48

CEGUI+Ogre: Render to Texture Question

Postby madcoma » Tue Dec 14, 2010 10:55

Hi,

i am desperately trying to implement a real-time minimap using Ogre and CEGUI.
There a i fact quite a few tutorials about this on the net, but they are all related to outdated versions of CEGUI.

What I´m doing is the following:

Code: Select all


//Create Ogre Texture
texturePtr = GraphicsController::GetSingleton().GetRoot()->getTextureManager()->createManual(
             "minimap_rtt",
             Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
             Ogre::TEX_TYPE_2D,
             width,
             height,
             0,
             Ogre::PF_R8G8B8,
             Ogre::TU_RENDERTARGET);

renderTexture = texturePtr->getBuffer()->getRenderTarget();

//Create a camera
minimapCam = SceneMgr->createCamera(name);
minimapCam->setPosition(100,-100,-400);
minimapCam->lookAt(0,0,-300);

/Create a viewport
minimapView = renderTexture->addViewport(minimapCam);
minimapView->setOverlaysEnabled(false);
minimapView->setClearEveryFrame(true);
minimapView->setBackgroundColour(Ogre::ColourValue::Black);


Up to that point everythin works fine, but its getting tricky when i want to pass my texture to CEGUI.

All tutorials state something like this:

Code: Select all

CEGUI::Texture &guiTex = mRenderer->createTexture(texturePtr);


But a method with a corresponding signature is not available in newer CEGUI Versions (I`m using the latest one)

So here`s my question:
How do i create a CEGUI texture from my Ogre texture?
Reading the API i found no method i can pass my ogre texture to? How can i do that?

User avatar
Mikademus
CEGUI MVP
CEGUI MVP
Posts: 130
Joined: Wed Mar 18, 2009 19:14

Re: CEGUI+Ogre: Render to Texture Question

Postby Mikademus » Tue Dec 14, 2010 12:53

Use the renderer for your graphics context (in your case the OGRE renderer):

http://cegui.org.uk/api_reference/class ... derer.html

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: CEGUI+Ogre: Render to Texture Question

Postby Kulik » Tue Dec 14, 2010 13:47

I haven't tried this but from looking at the API docs I think you can just call Renderer::createTexture() then cast the texture to OgreTexture and call OgreTexture::setOgreTexture on that. Please report if that works since I am not entirely sure :-)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests