diff options
author | Kenneth Russel <[email protected]> | 2006-06-19 20:56:54 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2006-06-19 20:56:54 +0000 |
commit | a0be832ec24145cb724a3a7a6cec72edcb4e95f9 (patch) | |
tree | 2553fb665ebe3d917b5d3a45229913eb9048aa9d /src/classes/com/sun | |
parent | f835b2a9298bce7790352b5750a47b0fead1e9c5 (diff) |
Added support to Java2D/JOGL bridge for GL_ARB_texture_rectangle
support in Java2D/OpenGL pipeline's FBO code path
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@816 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun')
-rwxr-xr-x | src/classes/com/sun/opengl/impl/Java2D.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/impl/Java2D.java b/src/classes/com/sun/opengl/impl/Java2D.java index 11a8f3da3..457c819bd 100755 --- a/src/classes/com/sun/opengl/impl/Java2D.java +++ b/src/classes/com/sun/opengl/impl/Java2D.java @@ -58,6 +58,8 @@ public class Java2D { private static Method getOGLViewportMethod; private static Method getOGLScissorBoxMethod; private static Method getOGLSurfaceIdentifierMethod; + // This one is currently optional and is only in very recent Mustang builds + private static Method getOGLTextureTypeMethod; // The following methods and fields are needed for proper support of // Frame Buffer Objects in the Java2D/OpenGL pipeline @@ -161,6 +163,20 @@ public class Java2D { System.err.println("Disabling Java2D/JOGL FBO support"); } } + + // Try to get an additional method for FBO support in recent Mustang builds + try { + getOGLTextureTypeMethod = utils.getDeclaredMethod("getOGLTextureType", + new Class[] { + Graphics.class + }); + getOGLTextureTypeMethod.setAccessible(true); + } catch (Exception e) { + if (DEBUG && VERBOSE) { + e.printStackTrace(); + System.err.println("GL_ARB_texture_rectangle FBO support disabled"); + } + } } catch (Exception e) { if (DEBUG && VERBOSE) { e.printStackTrace(); @@ -332,6 +348,25 @@ public class Java2D { } } + /** Returns the underlying texture target of the given Graphics + object assuming it is rendering to an FBO. Returns either + GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB. */ + public static int getOGLTextureType(Graphics g) { + checkActive(); + + if (getOGLTextureTypeMethod == null) { + return GL.GL_TEXTURE_2D; + } + + try { + return ((Integer) getOGLTextureTypeMethod.invoke(null, new Object[] { g })).intValue(); + } catch (InvocationTargetException e) { + throw new GLException(e.getTargetException()); + } catch (Exception e) { + throw (InternalError) new InternalError().initCause(e); + } + } + /** Returns either the given GLContext or a substitute one with which clients should share textures and display lists. Needed when the Java2D/OpenGL pipeline is active and FBOs are being |