Hi guys,
I read many tutorials in the last few days, but unfortunately I was unable to figure out, how to do the following...
The following 3 sample images are loaded during the startup of my game:
Hi guys,
I read many tutorials in the last few days, but unfortunately I was unable to figure out, how to do the following...
The following 3 sample images are loaded during the startup of my game:
You could store a collision map in memory and just check if the the picked pixel is transparent. Then you can just check from front to back and the first image with an opaque pixel is the one you want. The collision map can just be an array of bools or uint8_t (0 for transparent, 1 for opaque). Don't know if this is the fastest way, but it's definitely faster than reading from the GPU.
what do you mean by transparent borders? anti aliased ?how is your scene? are you using a Z buffer to decide which one is on the top?
if so I guess one way (for complex scenes otherwise I guess as DaveSF said it's better to do it on CPU) is to render the scene into a texture. and whilst drawing objects, give them an ID (sent to frag shader as a uniform and shader will draw objects in color of their ID) and then draw the scene (use depth test) and read the color of the point you want to check , to which object it belongs. and check it with you objects' IDs