Setting viewport background does nothing?

Hi all,

I’ve taken the Hello SimpleApplication and tried to change the background so that it is not black. The documentation says that to change the background of the viewport, use this:


And so I added that as the last line in simpleInitApp(), but I just get the same black background.




What is Hello SimpleApplication? Are you talking about HelloJME3?

I’ve added this line to HelloJME3 and it works for me"

[java]public class HelloJME3 extends SimpleApplication {

public static void main(String[] args){

HelloJME3 app = new HelloJME3();

app.start(); // start JME3



public void simpleInitApp() {

Box b = new Box(Vector3f.ZERO, 1, 1, 1); // take a cube shape

Geometry geom = new Geometry(“Box”, b); // create a Spatial from it

Material mat = new Material(assetManager,

“Common/MatDefs/Misc/SolidColor.j3md”); // load a solid color material

mat.setColor(“m_Color”, ColorRGBA.Blue); // make the solid color blue

geom.setMaterial(mat); // give the box the solid blue material

rootNode.attachChild(geom); // make the blue box appear in the scene




Yes, it was HelloJME3. I copied your code, and it does not set the background to blue. Maybe it’s an O/S issue: I’m using Mac OS 10.6.4 with Java 1.6.0 on Netbeans 6.9. I am using today’s build of JME 3.

Are you sure your modifications get applied? Try removing the line with attachChild() for example, then you should no longer see the box.

Well that’s odd. I removed rootNode.attachChild(geom) but the box is still there. Almost as if it’s running some other program. I did a clean and build, same issue. I commented out all of simpleInitApp, same issue. I ran HelloJME3 by right-clicking on the class itself and using Run File, same issue. What could it be running? I have no other classes in the project except HelloJME3.

And then… and then I renamed the class to Hello3EMJ, and nothing appeared (as expected). One wonders if jme3test.helloworld.HelloJME3 is included in the distro jar for some reason.

And now the background is blue!

Yes, its a known issue.