use of com.jme3.niftygui.NiftyJmeDisplay in project jmonkeyengine by jMonkeyEngine.
the class TestNiftyToMesh method simpleInitApp.
public void simpleInitApp() {
ViewPort niftyView = renderManager.createPreView("NiftyView", new Camera(1024, 768));
niftyView.setClearFlags(true, true, true);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, niftyView);
nifty = niftyDisplay.getNifty();
nifty.fromXml("all/intro.xml", "start");
niftyView.addProcessor(niftyDisplay);
Texture2D depthTex = new Texture2D(1024, 768, Format.Depth);
FrameBuffer fb = new FrameBuffer(1024, 768, 1);
fb.setDepthTexture(depthTex);
Texture2D tex = new Texture2D(1024, 768, Format.RGBA8);
tex.setMinFilter(MinFilter.Trilinear);
tex.setMagFilter(MagFilter.Bilinear);
fb.setColorTexture(tex);
niftyView.setClearFlags(true, true, true);
niftyView.setOutputFrameBuffer(fb);
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", tex);
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
Aggregations