Hello,
I have the following code and I haven't any 3D display. Thereis only a shape with uniform color.
Any 3D Display.
Could you tell what is the problem of my class ?
Thank.
public class TestSouris extends BaseGame {
private Node scene ;
private Camera cam ;
public static void main(String[] args)
{
TestSouris app = new TestSouris() ;
app.setDialogBehaviour(NEVER_SHOW_PROPS_DIALOG) ;
app.start() ;
}
protected void update(float interpolation)
{
}
protected void render(float interpolation)
{
display.getRenderer().clearBuffers();
display.getRenderer().draw(scene);
}
protected void initSystem()
{
try {
display = DisplaySystem.getDisplaySystem(properties.getRenderer());
display.createWindow(properties.getWidth(), properties.getHeight(), properties.getDepth(), properties.getFreq(), properties.getFullscreen()) ;
cam = display.getRenderer().createCamera(properties.getWidth(), properties.getHeight()) ;
}
catch (JmeException e)
{
e.printStackTrace() ;
System.exit(1) ;
}
ColorRGBA BackGroundColor = new ColorRGBA(0.9f, 0.9f, 1.0f, 1.0f) ;
display.getRenderer().setBackgroundColor(BackGroundColor) ;
cam.setFrustum(1.0f, 1000.0f, -0.55f, 0.55f, 0.4125f, -0.4125f) ;
Vector3f loc = new Vector3f(4.0f, 0.0f, 0.0f) ;
Vector3f left = new Vector3f(0.0f, -1.0f, 0.0f) ;
Vector3f up = new Vector3f(0.0f, 0.0f, 1.0f) ;
Vector3f dir = new Vector3f(-1.0f, 0f, 0.0f) ;
cam.setFrame(loc, left, up, dir) ;
display.getRenderer().setCamera(cam) ;
}
/**
* set up the scene
* @see com.jme.app.BaseGame#initGame()
*/
protected void initGame()
{
display.setTitle("jME - Primitives") ;
scene = new Node("Scene graph Node") ;
ZBufferState zbuffer = display.getRenderer().createZBufferState() ; // Un petit ZBuffer...
zbuffer.setEnabled(true) ;
zbuffer.setFunction(ZBufferState.CF_LEQUAL) ;
scene.setRenderState(zbuffer)