WaterRenderPass (now in CVS)

updated a while ago and now the water test all throw

setup tex7: 256,128

setup tex8: 256,128

setup tex9: 256,128

Could not load image…  URL was null.

java.lang.NullPointerException

at com.jmex.effects.water.WaterRenderPass.<init>(WaterRenderPass.java:216)

at jmetest.effects.water.TestProjectedWater.simpleInitGame(TestProjectedWater.java:115)

at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:474)

at com.jme.app.SimplePassGame.initGame(Unknown Source)

at com.jme.app.BaseGame.start(Unknown Source)

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

Aug 20, 2006 10:15:13 PM com.jme.app.BaseSimpleGame cleanup

INFO: Cleaning up resources.

Exception in thread "main" java.lang.NullPointerException

at jmetest.effects.water.TestProjectedWater.cleanup(TestProjectedWater.java:78)

at com.jme.app.BaseGame.start(Unknown Source)

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

 

sorry, sloppy checkin…forgot to change back the texture after doing some experimenting, fixed in CVS.



the checkin was:


Made flat shader versions transformable
Added rotation and translation to the TestSimpleQuadWater
Added testing for texturerenderer support to WaterRenderPass
Fixed exception handling in lwjgltexturerenderer

I updated jme today and exception is gone. nice lookin water! :smiley:

I'm trying to run this water render pass in a JMECanvasImplementor under Mac OS X 10.4.8 on a PPC iMac G5 iSight. If I create the same scene in a SimplePassGame game, everything works fine. In a JMECanvasImplementor, the last things the console shows is this:



setup tex97: 128,128
setup tex98: 128,128
setup tex99: 128,128



Before crashing. No stacktrace, a Mac OS X crash.

Any idea why this is?
Thanks ahead,
JWar


...

setup tex8: 256,256
setup tex9: 256,256
setup tex10: 256,256

...



i get that output too when instantiating a WaterRenderPass. even when i set loglevel to OFF. Funny thing is that the result works just perfectly fine. only those three lines in red on the console.

any ideas?

Andi

hey there again!



i found the reason for it. it seems to be a testing-output in LWJGLTextureRenderer() at the bottom.



    /**
     * <code>setupTexture</code> initializes a new Texture object for use with
     * TextureRenderer. Generates a valid gl texture id for this texture and
     * inits the data type for the texture.
     */
    public void setupTexture(Texture tex, int width, int height) {
        if (!isSupported) {
            return;
        }

        IntBuffer ibuf = BufferUtils.createIntBuffer(1);

        if (tex.getTextureId() != 0) {
            ibuf.put(tex.getTextureId());
            GL11.glDeleteTextures(ibuf);
            ibuf.clear();
        }

        // Create the texture
        GL11.glGenTextures(ibuf);
        tex.setTextureId(ibuf.get(0));
        TextureManager.registerForCleanup(tex.getTextureKey(), tex.getTextureId());

        GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureId());

        int source = GL11.GL_RGBA;
        switch (tex.getRTTSource()) {
            case Texture.RTT_SOURCE_RGBA: break;
            case Texture.RTT_SOURCE_RGB: source = GL11.GL_RGB; break;
            case Texture.RTT_SOURCE_ALPHA: source = GL11.GL_ALPHA; break;
            case Texture.RTT_SOURCE_DEPTH: source = GL11.GL_DEPTH_COMPONENT; break;
            case Texture.RTT_SOURCE_INTENSITY: source = GL11.GL_INTENSITY; break;
            case Texture.RTT_SOURCE_LUMINANCE: source = GL11.GL_LUMINANCE; break;
            case Texture.RTT_SOURCE_LUMINANCE_ALPHA: source = GL11.GL_LUMINANCE_ALPHA; break;
        }
        GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, source, 0, 0, width, height, 0);
        System.err.println("setup tex"+tex.getTextureId()+": "+width+","+height);
    }



the texture i am using is 512x512 ... but the output is 'setup tex8: 256, 256'

Andi

I just noticed a small bug in ProjectedGrid.



ProjectedGrid.matrixLookAt(…) and ProjectedGrid.matrixProjection(…) do not restore the OpenGL-stack after operating on it. The easy fix is to replace them with the functions with the same names from ProjectedTextureUtil.



Btw, in the future, should I post bugs at the forum or somewhere else?