Render to texture demo fails in linux

first i am running ubuntu 5.10 and radeon 9800pro and latest jme from cvs.

ok , another linux issue. I tested in windows and all is well but in linux rtt throws this exception:

java.lang.NullPointerException
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.activate(LWJGLTextureRenderer.java:633)
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.setBackgroundColor(LWJGLTextureRenderer.java:240)
   at jmetest.renderer.TestRenderToTexture.simpleInitGame(TestRenderToTexture.java:167)
   at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:414)
   at com.jme.app.BaseGame.start(BaseGame.java:65)
   at jmetest.renderer.TestRenderToTexture.main(TestRenderToTexture.java:74)
Exception in thread "main" java.lang.NullPointerException
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.activate(LWJGLTextureRenderer.java:633)
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.cleanup(LWJGLTextureRenderer.java:687)
   at jmetest.renderer.TestRenderToTexture.cleanup(TestRenderToTexture.java:78)
   at com.jme.app.BaseGame.start(BaseGame.java:89)
   at jmetest.renderer.TestRenderToTexture.main(TestRenderToTexture.java:74)



and this is where it happens in LWJGLTextureRenderer:

public void activate() {
        if (!isSupported) {
            return;
        }
        if (active == 0) {
            try {
                pbuffer.makeCurrent();
            } catch (LWJGLException e) {
                e.printStackTrace();
                throw new JmeException();
            }
        }
        active++;
    }



is this a jme bug or LWJGL?

Do you get the Warning "Failed to create Pbuffer."? If yes your card/driver simply does not support PBuffers - RTT is not possible - and the NPE is a jME bug:



isSupported in LWJGLTextureRenderer is never set to false. I think this should be done in two places: In the ctor in the else branch of

if (((caps & Pbuffer.PBUFFER_SUPPORTED) != 0))


and in initPbuffer after

LoggingSystem.getLogger().log(Level.WARNING,
                        "Failed to create Pbuffer.", e);


@author of RTT :): Correct?
Do you get the Warning "Failed to create Pbuffer."?

no, I did not get this warning, just the above exception.
isSupported in LWJGLTextureRenderer is never set to false. I think this should be done in two places: In the ctor in the else branch of
Code:
if (((caps & Pbuffer.PBUFFER_SUPPORTED) != 0))
and in initPbuffer after
Code:
LoggingSystem.getLogger().log(Level.WARNING,
                        "Failed to create Pbuffer.", e);
@author of RTT smiley: Correct?

you lost me here...

I also get exceptions when running imposter node demo and test cameraman demo
the testcameraman demo fails on same line of code as rtt

pbuffer.makeCurrent();

mud2005 said:

no, I did not get this warning, just the above exception.

Ah, ok, had another look into the code: the message should not be put out if lwjgl reports that pbuffer is not supported. RTT should then be switched off but is not.

you lost me here...

That was my suggestion for fixing the bug - not directly to you specifically.
I'm committing my fix to cvs to let you check it (I don't have a driver without pbuffer over here).
The NPE should be gone with RTT turned off (no inner box in TestRTT).

excellent, thanks for fast replies and all your work on a great open source engine  :smiley:

ok, now I get this NPE

java.lang.NullPointerException
   at jmetest.renderer.TestRenderToTexture.simpleInitGame(TestRenderToTexture.java:171)
   at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:414)
   at com.jme.app.BaseGame.start(BaseGame.java:65)
   at jmetest.renderer.TestRenderToTexture.main(TestRenderToTexture.java:74)
Feb 2, 2006 1:54:05 AM com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
Feb 2, 2006 1:54:05 AM com.jme.app.BaseGame start
INFO: Application ending.


at this line in rtt demo

tRenderer.getCamera().setLocation(new Vector3f(0, 0, 75f));



EDIT: I just ran fgl_glxgears pbuffer test and it ran fine.

Well, the check (caps & Pbuffer.PBUFFER_SUPPORTED) != 0) seems to return false - if you feel your system should support pbuffer post on the lwjgl forums.



That new PNE is thrown by the test because it does not check if tRender.isSupported() is true and assumes there is a camera - I fixed that one, too.

But probably the strategy to simply ignore RTT calls if pbuffer is not supported should be rethought…

now the test runs but just shows a spinning cube. Im going to post this on LWJGL forum and see whats up.



edit: I tried running jogl demos which require pbuffer and they also failed so Im beginning to think I dont have pbuffer support.

why Im not sure, I have radeon 9800pro with recent drivers. :frowning:

edit: I just found this

I was happy to see a new ATI driver release for Linux, with Xorg 6.8 support, yay!

Only to find that the new drivers still lack Pbuffer and VBO support.

We won't repeat the last ATI Linux rant, but I am going to sit here and make a sad face. Unfortunately, buying a nice shiny new NVidia card won't happen for another couple months.

:x ati can kiss my ass

Yuck, well at least mystery solved.