You are not logged in.

#1 2008-07-14 21:18:26

Bad Mother Fucker

Verify the transparency of a pixel

Hi, I want to verify the transparency of a pixel at a certain coordinate. The reason is that I want to know if the cursor is really on the button and not just on a transparent pixel.

I guess there is two way to check that.

1 - Check the data in the .h file with a PNGU_ function.
2 - Check directly the texture with a GX_ function.

So my question is, witch one is better and how to do it?

Thanks in advance,




#2 2008-07-14 21:43:51


Re: Verify the transparency of a pixel

For 3d, collision is best done with z-buffer... which could be done with your map but would require a corresponding z-texture for checking.

Closest with 2D is a separate collision map for objects, for the 2 reasons of size and the fact that textures are stored in texel format (which you'd have to decode every check).

Unless you have another reason to have more detail, you could probably create a 1bit resolution collision map of hit/miss (1/0), or scale it up to whatever degree you find easiest. More memory/less work would be a black/white map that is just stripping the alpha channel of your image and storing in in the lowest comfortable color resolution.

GX has functions to check Z and RGBA on the buffer, but those are total of everything written, not just your texture. Collision isn't really a graphics thing anyway, since based on design pattern it falls in the model/logic, not viewing category.



Board footer

Powered by FluxBB