diff options
Diffstat (limited to 'src/classes/com')
-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 |