Attached is a screenshot from a small OpenGL game called Orbit.  This
screenshot illustrates what I'm trying to accomplish.  The jpg I made looked
horrible, so I chose the png format.  It should be viewable in IE or
Netscape.  The text label for Saturn is the same size as the text label for
the moon.  Also, the frames per second counter in the lower left corner
aren't associated with any object in the scene.  The text is written to the
raster with glRasterPos2*().  The result is the text is written directly to
the viewplate.

I spent this weekend trying to figure out how this can be done in Java3D.  I
spent quite a lot of time searching on the net for examples, but only found
one that came close.  The game Tron3D in Java3D uses an extended Canvas3D
object to overload postSwap().  In there, the author writes directly to the
canvas if a String has been populated.  This seems to work fine for static
text, but doesn't clear properly if you change it.  I tried overloading
postRender() instead, but I had the same effect.  Drawing a 3, then a 6 gave
you something that looks closer to an 8.

The only other thing I can think of doing is floating some Java2D text
immediately in front of the View.  This doesn't seem to me to be the "right"
way to do it.  It certainly isn't in OpenGL.  I'm also not sure how
expensive Text2D.setString() is.

I also looked at Jon Barrilleaux's examples from his book.  Unfortunately,
since I don't have the book and my local bookstore didn't have it in stock,
I got lost in his library pretty quickly.  Off to Amazon.com...  But, there
are also some strange effects that happen when the window is resized -- the
items seem to need to figure out where they're supposed to be and take a few
frames to get repositioned.

If someone can point me in the right direction for this, I'd really
appreciate it.

orbit.png

Reply via email to