Here is an implementation of Raster labels (attached). It is basically Text2D
modified to used a Raster instead of a texture mapped polygon.
There are currently no plans to add raster text to the Java 3D utilities, but a
raster text utility may be considered if there is interest. I'd like to hear
your input.
Here is a comparision of raster text vs Text2D and Text3D:
Appearance:
Text2D: Raster text on a texture mapped polygon. Raster text, but
with sometimes blurry due to scaling of the texture mapped
image.
Text3D: Outline of font is converted to geometry. Excellent appearance
for large sizes. Can be blocky for small sizes when characters
are only a couple pixels wide.
Raster Text: Excellent appearance since it uses raster fonts only at their
indended size.
Size/orientation:
Text2D/Text3D: Full 3D orientation. Rotates/scales with transformations and
viewing. Can be made to align with screen using OrientedShape3D
(must edit Text2D to do this). With 1.3 can be made size
invariant using the new constant scaling on OrientedShape3D
Raster text: Always the same size and aligned with the screen, so only useful
for specific situations.
Memory Usage/Limitations:
Text2D: No sharing between primitives, each uses its own memory even
if they share characters. If texture is too wide it won't
display on some devices.
Text3D: Characters are defined in a Font3D so that the memory for
each character is shared between different instances of each
character.
Raster text: Label3D is like Text2D-- each primitive uses it's own copy of
the character definitions. With J3D 1.3 raster text could be
implemented using a font mechanism like Text3D. Also, Rasters
are sometimes slow on some PC cards.
Please send your comments to [EMAIL PROTECTED] and I'll post a summary.
Specifically: Do you have a need for raster text? Why? Would you need the
shared memory of a font-based implementation (that is, would you use a lot of
labels)?
BTW, Label3D gets the font metrics with:
Toolkit toolkit = Toolkit.getDefaultToolkit();
metrics = toolkit.getFontMetrics(font);
It caches the font metrics on the class to speed up creation of the labels.
> From: R Vegan <[EMAIL PROTECTED]>
> An alternative way is to get the FontMetrics object from
> the graphics handle of the BufferedImage object. This
> seems to work fine.
This is probably a better way, although Text2D uses presently uses the Toolkit
mechanism.
Thanks
Doug Gehringer
Sun Microsystems
Label3D.java