public static void main(String[] args) throws Exception {
// Instantiate StandardGame
StandardGame game = new StandardGame("A Simple Test");
// Show settings screen
if (GameSettingsPanel.prompt(game.getSettings())) {
// Start StandardGame, it will block until it has initialized successfully, then return
game.start();
/* Just try to create GLSLShaderObjectsState */
game.getDisplay().getRenderer().createGLSLShaderObjectsState();
// Create a DebugGameState - has all the built-in features that SimpleGame provides
// NOTE: for a distributable game implementation you'll want to use something like
// BasicGameState instead and provide control features yourself.
DebugGameState state = new DebugGameState();
// Put our box in it
Box box = new Box("my box", new Vector3f(0, 0, 0), 2, 2, 2);
box.setModelBound(new BoundingSphere());
box.updateModelBound();
// We had to add the following line because the render thread is already running
// Anytime we add content we need to updateRenderState or we get funky effects
box.updateRenderState();
state.getRootNode().attachChild(box);
// Add it to the manager
GameStateManager.getInstance().attachChild(state);
// Activate the game state
state.setActive(true);
}
}
This is the TestStandardGame class, with this line: "game.getDisplay().getRenderer().createGLSLShaderObjectsState();" throw this NullPointerException:
Exception in thread "main" java.lang.NullPointerException
at com.jme.scene.state.lwjgl.LWJGLShaderObjectsState.isSupported(LWJGLShaderObjectsState.java:125)
at com.jme.scene.state.lwjgl.LWJGLShaderObjectsState.<init>(LWJGLShaderObjectsState.java:91)
at com.jme.renderer.lwjgl.LWJGLRenderer.createGLSLShaderObjectsState(LWJGLRenderer.java:379)
at jmetest.game.TestStandardGame.main(TestStandardGame.java:60)
:?