This is kind of a follow up to a problem I had many months back which
I can't remember the topic name. My basic problem is that I'm trying
to render something on screen that has text labels. I need to make
sure to adjust the view so that all the text fits on the screen and
doesn't run off the edges. (But I don't want too much empty padding so
I want my values to be deterministic.)

I moved away from SCREEN_COORDS mode to OBJECT_COORDS mode because it
seemed that SCREEN_COORDS mode couldn't deterministically tell me what
the bounding box of the text would be until after it was rendered.
Since I need to compute my view range before I render, this didn't
work out.

So now I am back to OBJECT_COORDS mode and I also have to recalculate
my character height and aspect ratio manually. I have implemented this
and this part of the code seems to work well.

My problem though is that I'm still not consistent or correct values
for the size of my text via computeBound(). The values seem to be more
correct than SCREEN_COORDS mode, but I noticed my values are still off
slightly when I have a large scale projection change.

I'm trying to understand what's causing this. I haven't yet
determined/proved if the problem is in my stuff or how osgText works,
but I'm hoping to get a better explanation of how computeBound() works
for regular osgText modes. Basically, I just want to specify a string
via setText(), and a character size and aspect ratio via
setCharacterSize(), and call computeBound() on the text to get the
width and height of my text. Under OBJECT_COORDS, shouldn't this do
the correct thing? If the answer is yes, then I know the problem is in
my code. If the answer is no, I need to understand how it actually
works a little better and how to work around it.

I am under an orthographic projection (2D) if it makes a difference.

Thanks,
Eric
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to