PDA

View Full Version : How can I draw a circle on an existing object's surface?



ligm
12-04-2000, 02:46 AM
Hi
I have drawn a skull on the screen and now i want to draw a circle on its surface when i click the left button. The centre is the mouse location. I want the circle to rotate together when the skull is rotating. How can i do it? I use glReadPixels() to get the z value of the mouse location, then I use gluUnProject() to get the XYZ-object space coordinate of the centre. but how can i know on which plane the circle should be drawn?

thanks in advance
ligm

UncleBuck
12-04-2000, 07:18 AM
I think your best bet would be to use a projective texture. Use Unproject() to construct a ray in object space then you should be able to figure out a frustrum for the projection. See opengl.org for examples of projecting textures.