JOGL 1.1.1 PBuffer ATI setOffscreenRenderToTexture

Hello,

Upon upgrading to JOGL 1.1.1 from JOGL 1.0, creating a pbuffer no longer works. During Animator.run, GLException is thrown requesting that render-to-texture-rectangle is enabled. Enabling this property on an ATI Radeon 9000 is fruitless since the card does not support non-power-of-two textures.

By searching the forums, only other thread that mentioned similar problem (ATI card) was due to improper use of texture coordinates, however in this case nothing was changed from fully working to not working; the only changes being replacement of the libraries (jar, dll) with the latest version (1.1.1).

Some info:

GLEventListener.init {

GLCapabilities c = …
c.setDoubleBuffered(false);
c.setOffscreenRenderToTexture(true);

pBuffer = canvas.createOffscreenDrawable(c, 512, 512);
pBuffer.addGLEvenListener(getOffscreenRenderer());

// I then prime the pbuffer as per requirement, due to a bug in 1.0 which failed
// to call GLEventListener.init of the instance attached to the pbuffer.
pBuffer.display();
}

GLEventListener.run {
pBuffer.display();

gl.glActiveTexture(GL.GL_TEXTURE0_ARB);
gl.glEnable(GL.GL_TEXTURE_2D);
pBuffer.bindTexture();

// render geometry

pBuffer.releaseTexture();
}

What stumped me is the fact that this code works perfectly on JOGL 1.0, and also works “perfectly” provided pbuffer
support is not used on JOGL 1.1.1.

Win2k, Catalyst 5.8

If anyone has experienced this problem, please let me know.
Thanks for all the help you can offer.

-Al

I think this is a bug in JOGL’s pbuffer support on Windows. I think I see the exception you’re talking about and it isn’t valid.

I’d recommend avoiding render-to-texture. It isn’t portable (X11 has no render-to-texture extension) and can be emulated via glCopyTexSubImage2D. You could argue that JOGL should probably do such emulation only on X11 platforms and enable the extension on Windows and Mac OS X. We could consider that in a future release. However pbuffers are being de-emphasized in favor of FBOs in the OpenGL spec so we don’t want to invest a lot of time enhancing JOGL’s pbuffer support.

If turning off render-to-texture in your app and switching to glCopyTexSubImage2D works for you, please do so. The JSR-231 branch of the JOGL source tree doesn’t seem to have this particular bug, so if you have the ability to check out and build that branch (and port your app to the new APIs) that should probably solve your problem. We’re hoping to have a public build of the new APIs out in a couple of weeks.

Thanks for clarification Ken. I’ll check the latest from CVS.

I stumbled across the same problem under the same hardware conditions (ATI Mobility Radeon 9000), but using JSR231 instead of JOGL, as Ken suggested. The problem however remains the same. I used today’s nightly build.

Exception in thread “AWT-EventQueue-0” javax.media.opengl.GLException: Render-to-texture-rectangle requires render-to-texture to be specified
at com.sun.opengl.impl.windows.WindowsGLDrawable.glCapabilities2iattributes(WindowsGLDrawable.java:426)
at com.sun.opengl.impl.windows.WindowsPbufferGLDrawable.createPbuffer(WindowsPbufferGLDrawable.java:158)
at com.sun.opengl.impl.windows.WindowsPbufferGLDrawable.(WindowsPbufferGLDrawable.java:77)
at com.sun.opengl.impl.windows.WindowsGLDrawableFactory$2.run(WindowsGLDrawableFactory.java:146)
at com.sun.opengl.impl.windows.WindowsGLDrawableFactory.maybeDoSingleThreadedWorkaround(WindowsGLDrawableFactory.java:213)
at com.sun.opengl.impl.windows.WindowsGLDrawableFactory.createGLPbuffer(WindowsGLDrawableFactory.java:163)

Is there going to be a fix for it?

Ken, do you think that glCopySubTexImage2D can replace efficiently the use of pbuffers for rendering to a texture? Does it cover all cases/needs?

Sorry about that – I’ve just checked in a fix. Should be present in tonight’s nightly build.

I don’t personally have a lot of experience with render-to-texture since it’s non-portable (not supported on X11). I’d recommend you look into FBOs for portable render-to-texture support.