import com.jme.app.BaseGame;
import com.jme.bounding.BoundingSphere;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Sphere;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.Timer;
public class FyrestoneClient extends BaseGame
{
/*Screen Resolution Variables*/
int width, height, depth, freq;
boolean fullscreen;
/*End Screen Resolution Variables*/
private Node scene;
private Camera cam;
protected Timer timer;
public static void main(String args[])
{
FyrestoneClient app = new FyrestoneClient();
app.setDialogBehaviour(app.FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
app.start();
}
@Override
protected void update(float interpolation)
{
timer.update();
interpolation = timer.getTimePerFrame();
if(KeyBindingManager.getKeyBindingManager().isValidCommand("exit"))
finished = true;
display.getRenderer().clearBuffers();
display.getRenderer().draw(scene);
}
@Override
protected void render(float interpolation)
{
}
@Override
protected void initSystem()
{
//Store Screen Resolution Info
width = properties.getWidth();
height = properties.getHeight();
depth = properties.getDepth();
freq = properties.getFreq();
fullscreen = properties.getFullscreen();
//End Screen Resolution Storage
//Set up screen and camera
try
{
display = DisplaySystem.getDisplaySystem(properties.getRenderer());
display.createWindow(width, height, depth, freq, fullscreen);
cam = display.getRenderer().createCamera(width, height);
}
catch (JmeException e)
{
e.printStackTrace();
System.exit(1);
}
//End setup for screen and camera
//Background color
display.getRenderer().setBackgroundColor(ColorRGBA.black);
//End Background color
//Setting up camera to look at the terrain
cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);
Vector3f loc = new Vector3f(0.0f, 0.0f, 25.0f);
Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
Vector3f dir = new Vector3f(0.0f, 0.0f, -1.0f);
cam.setFrame(loc, left, up, dir);
cam.update();
display.getRenderer().setCamera(cam);
//End camera movements
//Timer for FPS
timer = Timer.getTimer();
//End Timer
KeyBindingManager.getKeyBindingManager().set("exit", KeyInput.KEY_ESCAPE);
}
@Override
protected void initGame()
{
scene = new Node("Root");
Sphere s = new Sphere("mySphere", 5, 5, 25);
s.setModelBound(new BoundingSphere());
s.updateModelBound();
scene.attachChild(s);
scene.updateGeometricState(0.0f, true);
scene.updateRenderState();
}
@Override
protected void reinit()
{
display.recreateWindow(width, height, depth, freq, fullscreen);
}
@Override
protected void cleanup()
{
}
}
When I run that code, which should display a black background and a sphere hovering somewhere in the middle of nothing, I get a white background. Please help.