Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing 2D icons from 3D point




On 17-Nov-07, at 4:48 AM, Lorenzo wrote:

Hi,
I have to draw the icon of a light source. The light is in a 3D space, but
if I draw the icon on a 3D space too, the icon looks smaller when the light
is far away. So I calculate its 2D point on the screen and I draw it with
the Ortho projection with the depth test disabled

As an alternative, once you have the screen coordinates for the corners of your icon you
can use gluUnproject to find world coordinates which will project there. It's not the most
efficient technique, but it can be optimized if necessary...


It works well. The only
problem is that I have to draw this icon "after" all the objects have been
drawn, otherwise it gets covered by the objects. Instead I need to draw it
immediately when I display the light. Is a way to do that e.g. writing a
high value to the depth buffer?

Can't you supply z-coordinates when you draw the vertices of your icon? For example, using
something slightly greater than what you specified to be the near distance in glOrtho().


Cheers,
dave

Best Regards
--
Lorenzo
email: email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden
References: 
 >Drawing 2D icons from 3D point (From: Lorenzo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.