Page 1 of 1

Why window texture colour is differnt from the image?

Posted: Sun Aug 14, 2011 01:29
by free2002
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.

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

Posted: Mon Aug 15, 2011 15:43
by Jamarr
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.