Hi all,
I've been trying and searching about this but got no clue still. All I need is to apply BloomPass into a StandardGame
To make it very simple, here is the code
public class TestGameState extends DebugGameState{
public TestGameState(){
super();
BloomRenderPass bPass = new BloomRenderPass(DisplaySystem.getDisplaySystem().getRenderer().getCamera(), 4);
}
}
And normal start up for a StandardGame of course and here comes the exception right at the BloomPass creation line
Exception in thread "main" java.lang.NullPointerException
at com.jme.renderer.lwjgl.LWJGLTextureRenderer.<init>(Unknown Source)
at com.jme.system.lwjgl.LWJGLDisplaySystem.createTextureRenderer(Unknown Source)
at com.jmex.effects.glsl.BloomRenderPass.<init>(Unknown Source)
Anyone got any idea ?
What he meant was that you must execute your task in the OpenGL thread. Check this page here… There is an example on the same page showing you how to do it.
Thanks Mindgamer, I was in too much of a hurry, I appreciate you filling in the gaps. 
Cheers for that guys,
Based on what I read from the example, I have worked out a total n00b solution but might easier to implement 
NPE usually means that you are accessing the SceneGraph from a thread that is not the OpenGL thread. Only the GameStates update() and render() methods are executed in the OpenGl thread automatically. For everything else you need to GameTaskQueue to inject things into the OpenGl Thread.
So, I made a global bloom pass then on render() check if its null then create it. And yep it works like a charm ! :D
public void render(float tpf) {
super.render(tpf);
if (bPass == null){
bPass = new BloomRenderPass(rootCam, 4);
bPass.add(rootNode);
this.getPassManager().add(bPass);
}
}
:-o noooo
remove the null check in the render method.
try this instead:
// your TestGameStates constructor:
GameTaskQueueManager.getManager().render(new Callable<Object>() {
public Object call() throws Exception {
bPass = new BloomRenderPass(rootCam, 4);
return null;
}
}).get();
bPass.add(rootNode);
this.getPassManager().add(bPass);
edit:
mhh while looking at it again .. i think your version isn't that bad i guess :)
This is one of the issues that made me switch away from StandardGame… In my jmecontext system, passes have a special initPass method which is called to initialize GL resources from inside the render thread.