XORing textures...

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

makofierce
Just popping in
Just popping in
Posts: 12
Joined: Mon Aug 16, 2010 02:02

XORing textures...

Postby makofierce » Wed Jul 13, 2011 16:03

Hi,

I want to draw one texture on top of another so that the second texture is only drawn on the opaque parts of the first texture, and is tiled with a position and size.

The specific example is for instance something like a cup or other object being filled in a button... the partly transparent texture inside the cup moves up to simulate the cup being filled while the rest of the (transparent) background stays the same.

Is there a way to do this? Thanks.

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

Re: XORing textures...

Postby Jamarr » Wed Jul 13, 2011 18:41

There is definitely a way to do this. Typically people will use a RTT (Render To Texture) technique for things like this; and it sounds like you will also want to apply a Masking technique when painting the texture.

CEGUI uses Imagesets for imagery, and Imagesets are wrappers for the underlying rendering systems textures. Basically you create a texture using the rendering subsystem, assign the texture to an imageset, and assign the imageset to the window. Then you manually render your scene to the underlying texture whenever it needs to be updated; when CEGUI renders the window it will use that texture.

I am not sure if RTT has been made any easier in v0.7+ since I have not upgraded yet, but there are many threads about RTT and a few concerning Masking on the forums, and there are many sources on the internet in general so you should not have much trouble figuring it out.
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 “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 4 guests