i have created some 2D sprites (TGA)
testure are on QUADS
my sprite represent a world map (planisphere)
i want to detect mouse clic on it
i detect selection of the QUADS but it is not suffisant !
i want to detect the region of the sprite not the QUAD where the texture is ?
detect a clic in a rect is simple in 2D ,and i think it’s not necessary to use the picking technique ?
how can i detect the real region off the sprite and the QUAD ?
the problem is my sprite (territory of the planisphere) are in contact and this pose some problems when i detect selection with the technique of picking !
the QUAD are superposed and this pose problem
i think the solution is in detection of the alpha region off the sprite !
have you a solution ?
I don’t think there is an easy (fast) way to do it, if you want to use opengl picking then you have to split the quad up into a number of smaller quads, then you can detect the one you hit, increases the resolution a bit.
Otherwise it’s tricky, you need to fine the U,V coordinates on the quad, and that’s not easy to do in reverse, at least not fast enough because it would require some interative method I guess.
Hi again !
One way would be to use the x,y value and the depth value returned from the hit buffer to get the pixel (glReadPixels) and check the color of it… but that’s not easy to get it working in reality I think.
i haved define a small quad in the center of each territory(sprite quads),for the selection
it work ,but im not realy satisfied
it easy to select an object in opengl
but i have no good solutions(simple) for select a complex specific 2D region(sprite image mask).
we can divide each sprite region to small TRIANGLE or QUAD but my territory (polygone complex (no convex)