Hi, I am new to JME3, most examples of JmeTests are running fine, but some never run successfully.
For instance, TestSpotLightShadows, TestNiftyToMash, TestMultiplesFilters, TestOctree will throw exception and failed to run. I tried on different PC with onboard or discrete GPU.
âError in applicationâ dialog prompt:
Uncaught exception thrown in Thread[LWJGL Render Thread,6,main]
NullPointerException
Output window:
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,6,main]
java.lang.NullPointerException
at com.jme3.post.FilterPostProcessor.updateLastFilterIndex(FilterPostProcessor.java:365)
at com.jme3.post.FilterPostProcessor.setFilterState(FilterPostProcessor.java:340)
at com.jme3.post.FilterPostProcessor.addFilter(FilterPostProcessor.java:112)
at jme3test.light.TestSpotLightShadows.setupLighting(TestSpotLightShadows.java:116)
at jme3test.light.TestSpotLightShadows.simpleInitApp(TestSpotLightShadows.java:177)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:744)
>>TestNiftyToMash
âError in applicationâ dialog prompt
Uncaught exception thrown in Thread[LWJGL Renderer Thread,6,main]
RuntimeException: com.jme3.assets.AssetNotFoundException: all/intro.xml
The last error is normal because the nifty demo is not shipped with jME anymore. You can download it and place it in the location the error complains about.
Iâve reproduced the bug. If you simply want to run the test, I suggest commenting out line 116 of TestSpotLightShadows.java in the jme3test.light package.
FilterPostProcessor seems to give this NPE whenever the first filter added is a disabled filter. Here is a simple app to demonstrate the bug:
[java]
package mygame;
Note that the NPE occurs in 3.0.7 but not in recent trunk versions of JME3. Here is a proposed fix to FilterPostProcessor.java in 3.0.7:
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -359,7 +359,7 @@
return;
}
}
- if (lastFilterIndex == -1) {
+ if (isInitialized() && lastFilterIndex == -1) {
//There is no enabled filter, we restore the original framebuffer
//to the viewport to bypass the fpp.
viewPort.setOutputFrameBuffer(outputBuffer);
I just discovered that my proposed fix exactly matches SVN change #10920 which @Nehon put into JME3âs âtrunkâ back in November. Apparently I missed this one back in March when I proposed the list of changes to be back-ported into â3.0stableâ.
@sgold said:
I've reproduced the bug. If you simply want to run the test, I suggest commenting out line 116 of TestSpotLightShadows.java in the jme3test.light package.
Thanks, I can run the TestSpotLightShadows, and I found TestPointLightShadows has same problem, after commenting out line 121, I can run the test.
What is fpp.addFilter(plsf); and why it crash the program?
@sgold said:
I just discovered that my proposed fix exactly matches SVN change #10920 which @Nehon put into JME3's 'trunk' back in November. Apparently I missed this one back in March when I proposed the list of changes to be back-ported into '3.0stable'.
Oh cool. I did make a stand alone commit in the end.
Thanks Steve, your thoroughness is really appreciated.
@limwerks said:
Thanks, I can run the TestSpotLightShadows, and I found TestPointLightShadows has same problem, after commenting out line 121, I can run the test.
What is fpp.addFilter(plsf); and why it crash the program?
There are two mechanisms for adding shadows to a JME scene. One is whatâs called a shadow filter, the other is whatâs called a shadow renderer. Filters work via a special scene processor called the FilterPostProcessor.
TestSpotLightShadows demonstrates both mechanisms, but since it only uses one mechanism at a time, starting with the shadow renderer, it disables the shadow filter at startup.
We made a change between JME 3.0.5 and 3.0.7 to address a different issue, and it has the unfortunate side-effect that when a disabled filter is added to a FilterPostProcessor, you get a NullProtectionException. If you add the filter first and then disable it, you will work around the bug in 3.0.7.