RTT in 0.8

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

sunflare
Just popping in
Just popping in
Posts: 1
Joined: Wed Sep 11, 2013 21:26

RTT in 0.8

Postby sunflare » Wed Sep 11, 2013 21:40

hi,

i'm trying to render my ogre scene into a texture and draw it in a cegui window.

everything i found online about this is outdated and contains something like this:

Code: Select all

CEGUI::Imageset& imageSet = CEGUI::ImagesetManager::getSingleton().create("RTTImageset", guiTex);

it seems like CEGUI::Imageset was removed in 0.8 (was it?)

how can I draw a CEGUI::Texture without Imageset?

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

Re: RTT in 0.8

Postby Kulik » Tue Sep 17, 2013 09:38

Yes, check porting tips 0.7 to 0.8

Fingon
Just popping in
Just popping in
Posts: 2
Joined: Thu Oct 17, 2013 11:14

Re: RTT in 0.8

Postby Fingon » Thu Oct 17, 2013 11:29

I have the same question. Based on a lot of puzzling with old code snippets, the documentation and the 0.8 changelog I've come up with the following code. But I'm still doing something wrong

Code: Select all

// make the texture
CEGUI::Texture &guiTex = mRenderer->createTexture("texname", tex);

// put the texture in an image
const CEGUI::Rectf rect(CEGUI::Vector2f(0.0f, 0.0f), guiTex.getOriginalDataSize());
CEGUI::BasicImage image("RTTImage", &guiTex, rect, CEGUI::Vector2f(0, 0), CEGUI::AutoScaledMode::ASM_Both, CEGUI::Sizef(0, 0));

// add the image to the image manager   
CEGUI::ImageManager::getSingleton().addImageType<CEGUI::BasicImage>("RTTImageset");
CEGUI::ImageManager::getSingleton().create("RTTImageset", "RTTImage");

// make a static window
CEGUI::Window *si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "RTTWindow");
si->setSize(CEGUI::USize(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.4f, 0)));
si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, 0.0), CEGUI::UDim(0.0f, 0.0f)));

// set the image on the static window
si->setProperty("Image", "RTTImage");

root->addChild(si);


This all runs fine, without any warnings in the cegui.log file. Until the si->setProperty("Image", "RTTImage"); line, at which the program crashes. What am I doing wrong? Or where can I find more info on RTT in cegui 0.8 ?
Thanks!

Fingon
Just popping in
Just popping in
Posts: 2
Joined: Thu Oct 17, 2013 11:14

Re: RTT in 0.8

Postby Fingon » Thu Oct 17, 2013 12:59

I found a solution (well, somebody else did), i'll post it here too. Instead of

Code: Select all

CEGUI::BasicImage image("RTTImage", &guiTex, rect, CEGUI::Vector2f(0, 0), CEGUI::AutoScaledMode::ASM_Both, CEGUI::Sizef(0, 0));

// add the image to the image manager   
CEGUI::ImageManager::getSingleton().addImageType<CEGUI::BasicImage>("RTTImageset");
CEGUI::ImageManager::getSingleton().create("RTTImageset", "RTTImage");


it should be

Code: Select all

CEGUI::BasicImage* image = (CEGUI::BasicImage*)( &CEGUI::ImageManager::getSingleton().create("BasicImage","RTTImage"));
image->setTexture(&guiTex);
image->setArea(rect);
image->setAutoScaled(CEGUI::ASM_Both);


I'm still wondering though if this is the intended way to do it, i.e. cast a created image to a BasicImage using pointers?

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: RTT in 0.8

Postby Ident » Mon Nov 11, 2013 21:37

Yes that is how it is supposed to be done because there could be other kinds of Image than BasicImage, which do not necessarily use textures. This is actually the case in my upcoming GSOC2013 merge which uses SVGImage as well.

addImageType() is definitely not what you want to use, as the function name says it adds the type not the image itself.
CrazyEddie: "I don't like GUIs"


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: Google [Bot] and 9 guests