[Plib-users] odd text question
Brought to you by:
sjbaker
From: Sylvan C. <si...@si...> - 2000-02-20 21:06:06
|
i have an odd text usage question that i'm hoping someone might be able to help me with. what i'd like to do is have text labels on objects in the scene, indicating information about that object. my first pass at this was to use gluProject to derive the window coordinates, and then render text with fntRenderer and an orthographic projection matrix. the result was perfect in all but one way: i don't want labels to appear for objects which are behind other objects. in other words, i'd very much like to be able to render the text at the same depth as the object, so that it gets obscured by closer objects in the scene graph. hack as i might (including writing my own text renderer), i found no way to match up the depth buffer. i tried finding the z distance from the camera to the object, drawing the text with that z distance and not clearing the depth buffer and such, but it seems that once i switch to the orthographic projection matrix, i can't get anything i draw to be obscured by anything else drawn in the frame. i then tried rendering the text as 3d text, rotating it to face the camera and scaling it based on the inverse of the distance in order to get it to maintain a uniform size. this works, but of course perspective text simply isn't orthographic text; it changes size noticeably from the center of the viewport to the edge of the viewport. if anyone has any ideas, even if it means not using fntRenderer or extending it drastically, i'd very much appreciate it. thanks. -s |