sorry for urgent tag but i am running out of time for evaluating jmonkey for the task at hand. in the multiview example, i add a label next to teapot. it shows up in main cam view but not in others. what gives? is it possible to render label correctly, ie. left to right, in a multiple view use case… it makes sense for a object to show other side but label should not be in reverse. thanks.
How are you attaching the label, is it a quad with text, is it a Nifty component? What views are you talking about? Viewports?
If viewports, remember that with multiple viewports you have to tell them what nodes to render:
TestMultiViews.java shows how to do multiple GUI viewports too.
hi, i just added a bitmaptext next to a teapot in the multi view port example as shown below. i am showing the teapot from 4 different angles. what i need is a label next to the object, not on the object, and readable label rendering in correct left to right order in all four views. -a
public class Untitled4 extends SimpleApplication
public static void main(String args)
Untitled4 app = new Untitled4();
public void simpleInitApp()
Geometry tp = (Geometry) assetManager
DirectionalLight dl1 = new DirectionalLight();
DirectionalLight dl2 = new DirectionalLight();
DirectionalLight dl3 = new DirectionalLight();
BitmapText label = guiFont.createLabel(“Teapot”);
label.setLocalTranslation(0, 0, 0);
cam.setViewPort(.5f, 1f, 0f, 0.5f);
Camera left = cam.clone();
left.setViewPort(0f, 0.5f, 0f, 0.5f);
left.setLocation(new Vector3f(0f, 0f, -10f));
ViewPort leftView = renderManager.createMainView(“left”, left);
leftView.setClearFlags(true, true, true);
Camera front = cam.clone();
front.setViewPort(0f, 0.5f, 0.5f, 1f);
front.setLocation(new Vector3f(10f, 0f, 0f));
ViewPort frontView = renderManager.createMainView(“front”, front);
frontView.setClearFlags(true, true, true);
Camera back = cam.clone();
back.setViewPort(0.5f, 1f, 0.5f, 1f);
back.setLocation(new Vector3f(-10f, 0f, 0f));
ViewPort backView = renderManager.createMainView(“back”, back);
backView.setClearFlags(true, true, true);
// cam.setViewPort(0, .5f, .5f, 1f);
// cam.setLocation(new Vector3f(3.3212643f, 4.484704f, 4.2812433f));
// cam.setRotation(new Quaternion(-0.07680723f, 0.92299235f, -0.2564353f, -0.27645364f));
Text is just a geometry with a font texture on it, so if you want it to be different in each view you will have to have 4 scenes of the same geometries but make the labels face the camera in each one.
Or you can have your one scene, and then 4 new viewport overlays on top of the regular 4 scene viewports, these ones rendering the labels facing the camera (using a billboard control).
Or, probably even easier, is just attach another node to each viewport that is your different text. You can attach several scenes to each viewport.
Thanks for the quick answers. They all sound foreign to me but at lease I have a direction now. I will start rtfm based on the suggestions. It would be great if the TestMultiViews example included text as well because text is obviously a different matter than other geometries since it has to keep its direction in all different views. Thanks.
Add it to the gui node not the root node and it will always point towards the camera…
Or use a billboard if you want the text inside the scene. Billboards have code to keep them pointed towards the camera…