Problem with EnvNode class

2 replies [Last post]
KMacKenzie's picture
Offline
Joined: 12/10/2010

I am getting the error:
 
3-Mar-2011 7:12:30 PM com.jme.scene.Node <init>
INFO: Node created.
3-Mar-2011 7:12:30 PM com.jme.scene.Node <init>
INFO: Node created.
3-Mar-2011 7:12:30 PM com.jme.scene.Node attachChild
INFO: Child "null" attached to this node "null"
3-Mar-2011 7:12:30 PM com.jme.system.lwjgl.LWJGLDisplaySystem <init>
INFO: LWJGL Display System created.
java.lang.NullPointerException
 at env3d.advanced.EnvNode.<init>(EnvNode.java:57)
 at Creature.<init>(Creature.java:12)
 at Fox.<init>(Fox.java:7)
 at Game.<init>(Game.java:31)
 at Game.main(Game.java:104)
 
When I try and run a program after inheriting from EnvNode instead of EnvObject.
I beleive the problem may be on line 57 of EnvNode.class is currently:
    this.transparentState = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
I think this should be changed to
    this.transparentState = currentDisplay.getDisplaySystem().getRenderer().createBlendState();
 
I have spent some time trying to figure out how to recompile the class file properly after making the changes so I can test my hunch but I am not having any luck, and giving up for now. Jason what is the best/easiest way to modify the Env3d package files?
Thanks in advance
 
Kenny

Offline
Joined: 12/13/2010
Hi Kenny, EnvObject must be

Hi Kenny,

EnvObject must be created AFTER the creation of the Env() object.  In your code, you basically need to create all your objects like so:

Env env = new Env();

createObjects();

...

where createObject() is a method that creates all of your game objects.

Sorry that I forgot to mention it :p

Jason

KMacKenzie's picture
Offline
Joined: 12/10/2010
Thanks, that was it exactly.

Thanks, that was it exactly. Successfully getting 300+ moving objects before fps starts to drop below 60.