Rendering Text to a Box

Does anyone know how to render text to the side of a box or to a node? I looked at Font2D and Text2D but couldn't figure it out…



I was looking at the code from this post: http://www.jmonkeyengine.com/jmeforum/index.php?topic=6937.0, but whenever I add my textNode node to my rootNode, I only get text in the lower left hand corner and rotating / translating it doesn't seem to work.



Do I need to use Font3D? Is there a way to make the rendering smoother if so? The text looks pretty jaggedy for Font3D as opposed to regular text.



Also, when using Font3D I am getting several warnings (but everything renders in the end)…


WARNING: Error in char: (202:

the most simply way that i know of is to use Text.createDefaultTextLabel("the useless name of my text spatial", "my actual text") and put the text where you want it to appear by changing the local translation (and calling updategeometricstate i think). it should work. for me, it does.

HamsterofDeath said:

the most simply way that i know of is to use Text.createDefaultTextLabel("the useless name of my text spatial", "my actual text") and put the text where you want it to appear by changing the local translation (and calling updategeometricstate i think). it should work. for me, it does.


Using this doesn't render the text in a 3d mode, however. It renders text in ortho. I am trying to make a label for a Box or a 3d object which will go over that 3d object and change size relative to the 3d object it is attached to when I move to/away from it. I don't even need it to be a billboard, just want to render some text over a 3d object. Text3d uses tons of memory and I can't use it for labeling hundreds of 3d objects.

There are a few text label tools floating around on the forum, including one made by me:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=6485.0

(If you don't want a billboard, you can also just get the textured quad instead)