Page 1 of 1

XORing textures...

Posted: Wed Jul 13, 2011 16:03
by makofierce
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.

Re: XORing textures...

Posted: Wed Jul 13, 2011 18:41
by Jamarr
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.