Problems w/ water in tests

Hey all,  just fired up Test Island to show off and was presented with this:





Then I tested the simpleQuadWater and was presented with this:





Then I ran testProjectedWater and got this error:


Jan 7, 2009 1:16:35 PM com.jme.scene.Node attachChild
INFO: Child (quadNode) attached to this node (rootNode)
Jan 7, 2009 1:16:35 PM class jmetest.effects.water.TestProjectedWater start()
SEVERE: Exception in game loop
java.lang.NullPointerException
        at org.lwjgl.opengl.GL11.glGetInteger(GL11.java:1337)
        at com.jmex.effects.ProjectedTextureUtil.saveMatrixMode(ProjectedTextureUtil.java:116)
        at com.jmex.effects.ProjectedTextureUtil.matrixLookAt(ProjectedTextureUtil.java:132)
        at com.jmex.effects.water.ProjectedGrid.update(ProjectedGrid.java:191)
        at com.jmex.effects.water.ProjectedGrid.draw(ProjectedGrid.java:152)
        at com.jme.scene.Spatial.onDraw(Spatial.java:411)
        at com.jme.scene.Node.draw(Node.java:520)
        at com.jme.scene.Spatial.onDraw(Spatial.java:411)
        at com.jme.renderer.jogl.JOGLRenderer.draw(JOGLRenderer.java:1241)
        at com.jme.renderer.pass.RenderPass.doRender(RenderPass.java:52)
        at com.jme.renderer.pass.Pass.renderPass(Pass.java:90)
        at com.jme.renderer.pass.BasicPassManager.renderPasses(BasicPassManager.java:90)
        at com.jme.app.SimplePassGame.render(SimplePassGame.java:83)
        at com.jme.app.BaseGame.start(BaseGame.java:87)
        at jmetest.effects.water.TestProjectedWater.main(TestProjectedWater.java:79)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at jmetest.TestChooser.start(TestChooser.java:465)
        at jmetest.TestChooser.main(TestChooser.java:444)
Jan 7, 2009 1:16:35 PM com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
Jan 7, 2009 1:16:35 PM com.jme.app.BaseGame start
INFO: Application ending.
BUILD SUCCESSFUL (total time: 35 seconds)



I then updated my SVN copy (which should have been up-to-date anyway) and re-ran all the tests and the results were exactly the same.

I was like huh  :?, these are the jME tests; so I fired up my own project and the water seems fine; which is using a 'custom' built jME jar file, so has not been affected by any SVN changes in the last 1-2 weeks.  Would someone mind checking the water tests out and seeing if there is an issue...

I get the same error. And again an issue in connection with jogl  :frowning:

I find it quite interesting that in the same stack trace you have references to both JOGL and LWJGL, maybe that's an indication of where your problem may be…



java.lang.NullPointerException

        at org.lwjgl.opengl.GL11.glGetInteger(GL11.java:1337)

        at com.jmex.effects.ProjectedTextureUtil.saveMatrixMode(ProjectedTextureUtil.java:116)

        at com.jmex.effects.ProjectedTextureUtil.matrixLookAt(ProjectedTextureUtil.java:132)

        at com.jmex.effects.water.ProjectedGrid.update(ProjectedGrid.java:191)

        at com.jmex.effects.water.ProjectedGrid.draw(ProjectedGrid.java:152)

        at com.jme.scene.Spatial.onDraw(Spatial.java:411)

        at com.jme.scene.Node.draw(Node.java:520)

        at com.jme.scene.Spatial.onDraw(Spatial.java:411)

        at com.jme.renderer.jogl.JOGLRenderer.draw(JOGLRenderer.java:1241)

        at com.jme.renderer.pass.RenderPass.doRender(RenderPass.java:52)

        at com.jme.renderer.pass.Pass.renderPass(Pass.java:90)

        at com.jme.renderer.pass.BasicPassManager.renderPasses(BasicPassManager.java:90)

        at com.jme.app.SimplePassGame.render(SimplePassGame.java:83)

        at com.jme.app.BaseGame.start(BaseGame.java:87)

        at jmetest.effects.water.TestProjectedWater.main(TestProjectedWater.java:79)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:585)

        at jmetest.TestChooser.start(TestChooser.java:465)

        at jmetest.TestChooser.main(TestChooser.java:444)

ProjectedTextureUtil makes GL calls… more specifically, LWJGL ones. ProjectedTextureUtil should be refactored to not use any OGL calls (they are not required).

I added it: http://code.google.com/p/jmonkeyengine/issues/detail?id=29

I’m on it…



Edit:

(I can’t believe I missed the LWJGL/JOGL thing , thanx nymon)



Changes are committed, and unless JOGL just has some very polluted waters:



I think there might be something weird that needs to be addressed in all the water stuff for JOGL (or maybe its an indication of a general jME/JOGL issue rather…)



(Momoko_Fan would mind giving me a hint as to how to manipulate the Matrix modes directly in jME??, I just re-worked the class to support both LWJGL and JOGL but after re-reading your post I think you were hinting at something else…)

basixs said:

(Momoko_Fan would mind giving me a hint as to how to manipulate the Matrix modes directly in jME??, I just re-worked the class to support both LWJGL and JOGL but after re-reading your post I think you were hinting at something else...)

What I was saying is that it's possible to do it without using any GL calls. When I have time I'll check it..

Why JOGL and LWJGL don't act the same way here? Maybe it has something to do with the vertical order of the texture coordinates. During the development of JOGL, between a JOGL 1.1.0 beta version and JOGL 1.1.1, texture coordinates have been inverted to match with Java2D behavior.