Why window texture colour is differnt from the image?

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

free2002
Just popping in
Just popping in
Posts: 2
Joined: Sun Jul 24, 2011 03:25

Why window texture colour is differnt from the image?

Postby free2002 » Sun Aug 14, 2011 01:29

Hi,
I want to draw images created from the window texture to screen, and my steps are as follows: (version: CEGUI 0.7,5)

1. create a window "xxxx" which uses a transparency picture as its background.

2. create an image from this window's texture
Image image = ....
Window* pWindow = WindowManager::getSingleton().getWindow("xxxx");
RenderingSurface* pRS = &pWindow->getTargetRenderingSurface();
RenderingWindow* pRW = static_cast<RenderingWindow*>(pRS);
TextureTarget* pTT = &pRW->getTextureTarget ();
Texture* pTexture = pTT->getTexture();
Imageset* pImageset = &ImagesetManager::getSingleton().create("test", *pTexture);
pImageset->defineImage(); //image
3. draw this image to the GeometryBuffer
image.draw(*pGeometryBuffer, Rect(0, 0, width, height), 0);

4. call pGeometryBuffer->draw to draw the image to screen

The question is, the image colour GeometryBuffer draws is different from the window's background colour.
And I found the problem maybe come from the alpha blend, is there any method to resolve it ?? thanks

Sorry for my buggy english.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Why window texture colour is differnt from the image?

Postby Jamarr » Mon Aug 15, 2011 15:43

1. I am not sure how you managed to post this in the General Discussion forum, given it is at the bottom of the index page, but this belongs in Beginners Help. Please try to post in the appropriate sub-forums.

2. Please make sure you surround all code segments with [code][/code] tags as it makes reading your code easier.

3. I assume it is not rendering correctly because you are drawing things out of order by manually calling GeometryBuffer::draw. Typically drawing is handled automatically via CEGUI::System::renderGUI(); this sets the appropriate render states and draws windows in the appropriate order. I think that if you just use Imageset::defineImage properly and then assign the image back to the "xxxx" window via Window::setProperty and let CEGUI handle drawing it would render correctly.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 15 guests