Keeping an object's label on the screen
"Monteleone, Nathan" <[email protected]>
| Newsgroups | gmane.games.devel.algorithms |
|---|---|
| Message-ID | <[email protected]> |
I have to draw some billboard text over some shapes we've "painted" onto our terrain via multitexturing. Normally this is easy enough - just plop the label in an auto-rotated billboard and float it above the center of the geometry. But I need to keep the label on screen at all times if any part of the painted geometry is visible. I.e. if I have a square painted on the terrain, but I can only see a small corner of it, I still need to show the whole label. What's a good algorithm to figure out where to draw the label? The idea I had in mind was to do something in screen space... I'd write out an object ID version of the projected texture, apply it, render the terrain geometry into a low-res buffer, then compute min/max screen coords for each object. Then I could just draw my text label in screen space based on that information. Is this a sane approach? Otherwise I'd have to create a geometric representation of our shapes that conforms to the terrain and choose a 3d location for my text based on the view frustum. That seems painful to implement efficiently. Thanks, Nathan ------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf _______________________________________________ GDAlgorithms-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list