Testing for RTT support

i'm trying to make a simple method to test for render-to-texture (RTT) support. however the following code returns wrong values. for example: i run this on a MacBook Pro, which runs my RTT code just fine, but i get a "NO" from the code below.



what am i doing wrong?


   public static void setIsRTTsupported() {
      isRTTsupported = ((Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0);
      System.out.println("Testing for RTT (render to texture) support..."+((isRTTsupported) ? "YES" : "NO"));      
   }

Download glview and post the report here.

You can do RTT without a card that support native "direct to texture" pbuffer rendering…  it's just done through copying from the pbuffer to the texture.  Your card indicates it supports fbo and pbuffer.  In jME you can grab a TextureRenderer and ask if it is supported, which may be easier than what you are trying to do.

thanks for the suggestions. i modified my method to this:


   public static void setIsRTTsupported() {
      TextureRenderer tr = DisplaySystem.getDisplaySystem().createTextureRenderer(1, 1, TextureRenderer.RENDER_TEXTURE_2D);
      isRTTsupported = null!=tr && tr.isSupported();      
   }



however when i test this on a different machine with a different opengl implementation (a Mac Mini -- i can post the glview output if you want), i get a  "true" from the above method, while it still crashes when attempting to do the render-to-texture. so i'm not sure if it's returning a false positive, or if there's an additional issue:

Jan 24, 2008 5:41:58 PM class com.jme.renderer.lwjgl.LWJGLTextureRenderer render(Spatial, Texture, boolean)
SEVERE: Exception
java.lang.RuntimeException: FrameBuffer: 1, has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.checkFBOComplete(Unknown Source)
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.render(Unknown Source)
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.render(Unknown Source)
   at myGame.display.widget.Television.render(Television.java:114)
   at myGame.display.widget.Television.render(Television.java:99)
   at myGame.gamestate.hud.GSUnitInspecter.render(GSUnitInspecter.java:267)
   at com.jmex.game.state.GameStateNode.render(Unknown Source)
   at com.jmex.game.StandardGame.render(Unknown Source)
   at com.jmex.game.StandardGame.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:613)
[UncaughtExceptionHandler] uncaughtException org.lwjgl.opengl.OpenGLException: Invalid framebuffer operation (1286)



so is my setIsRTTsupported() method wrong? or do i need an additional test based on the GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT thingy?

thanks in advance. these forums are super helpful and it's much appreciated.

Looks to me like there is something wrong in the code, a test case showing the bug would be helpful!  Are you using the cvs version of jME?

i changed to the CVS version of code. the problem appears to be gone. (although i've made a lot of other changes, so can't say for sure if the code update was the reason.) thanks everyone for the help.