Transparent png images with gui objects

Does transparent images work with direct gui objects? Im having some problems with this. It looks like transparent pngs don’t seem to work on gui objects.

Im building my gui like this. The background image contains all the buttons drawn on the background. The only thing i pass to the DirectButton is the screen area that is sensitive to the mouse and the button border image. NOTE: Transparency saves me A LOT of time and work than if i had to create separate images for normal, rollback, clicked and disabled.

I have this background image:

When mouse rolls over one of the buttons or the button is disabled the only thing that the direct button would have to do was to draw an apropreate border on top of it:

In a complex gui like this (it will be much more complex in the future) i would have to painfully save each button as four separate images:

DirectGui just uses ordinary Panda geometry, so transparency works in DirectGui objects exactly as well as it works throughout the rest of Panda. That is to say, it works fine, though you might have to explicitly enable it with setTransparency() (particularly if you just loaded a texture via loader.loadTexture(), instead of using egg-texture-cards), and occasionally you have to deal with sorting issues and the like.

Also, the “clickable region” of the DirectGui object is derived from the entire geometry, including its invisible parts.

What sort of problems are you having specifically?


What would happen is that the border image would show a black color or some other noise color in what was suposed to be transparent.

The setTransparency method solved the problem. Thanks.