To my knowledge the only way to do this is to have transformed textured
coplanar geometry parallel to the image plate, and update its transform
every frame to remain synchronized with the view.  This works great for
untextured geometries or for textures that change infrequently.
Unfortunatly, text is the biggest problem.  First of all you end up creating
very large textures to show your text if it spans any kind of space at all.
Secondly, you have to use the video texture technique (y-up and
by-reference) and your texture gets sent to the card over and over again.

If there is a way to quickly write to the back-buffer before swap I have not
seen it.  In OpenGL this is done very easily, but in Java3d this is quite
slow.

If you are interested in some example code to write synchronized image
plates I am attaching a java file.

Dave Yazel

-----Original Message-----
From: Corysia Taware [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 02, 2001 2:43 PM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Overlay example?


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.

TestConsole.java

Reply via email to