Top Description Fields Constructors Methods
jogamp.opengl.awt

public Class Java2D

extends Object
Class Inheritance
Imports
java.awt.Graphics, .GraphicsConfiguration, .GraphicsDevice, .GraphicsEnvironment, .HeadlessException, .Rectangle, java.lang.reflect.Field, .InvocationTargetException, .Method, java.security.AccessController, .PrivilegedAction, com.jogamp.opengl.GL, .GLContext, .GLDrawableFactory, .GLException, .GLProfile, com.jogamp.common.os.Platform, jogamp.common.os.PlatformPropsImpl, jogamp.opengl.Debug

Defines integration with the Java2D OpenGL pipeline. This integration is only supported in 1.6 and is highly experimental.

Field Summary

Modifier and TypeField and Description
private static Method
private static boolean
private static Method
public static final int
private static boolean
public static final int
private static Method
private static Method
private static Method
private static Method
private static Method
private static boolean
private static Method
private static Method
private static boolean
private static boolean
private static boolean
private static Method
private static GLContext
private static Method
public static final int
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
private static void
public static long
createOGLContextOnSurface(final Graphics g, final long shareCtx)

(Mac OS X-specific) Creates a new OpenGL context on the surface associated with the given Graphics object, sharing textures and display lists with the specified (CGLContextObj) share context.

public static void
destroyOGLContext(final long ctx)

(Mac OS X-specific) Destroys the given OpenGL context.

public static GLContext
filterShareContext(final GLContext shareContext)

Returns either the given GLContext or a substitute one with which clients should share textures and display lists.

public static Rectangle
getOGLScissorBox(final Graphics g)

Returns the OpenGL scissor region associated with the given Graphics object, taking into account all clipping regions, etc. To avoid destroying Java2D's previous rendering results, this method should be called and the resulting rectangle's bounds passed to a call to glScissor().

public static Object
getOGLSurfaceIdentifier(final Graphics g)

Returns an opaque "surface identifier" associated with the given Graphics object.

public static int
getOGLSurfaceType(final Graphics g)

Returns the underlying surface type for the given Graphics object.

public static int
getOGLTextureType(final Graphics g)

Returns the underlying texture target of the given Graphics object assuming it is rendering to an FBO.

private static int
public static Rectangle
getOGLViewport(final Graphics g, final int componentWidth, final int componentHeight)

Returns the OpenGL viewport associated with the given Graphics object, assuming that the Graphics object is associated with a component of the specified width and height.

public static GLContext
getShareContext(final GraphicsDevice device)

Returns the GLContext associated with the Java2D "share context", with which all contexts created by JOGL must share textures and display lists when the FBO option is enabled for the Java2D/OpenGL pipeline.

private static void
public static void
invokeWithOGLContextCurrent(final Graphics g, final Runnable r)

Makes current the OpenGL context associated with the passed Graphics object and runs the given Runnable on the Queue Flushing Thread in one atomic action.

public static boolean
invokeWithOGLSharedContextCurrent(final GraphicsConfiguration g, final Runnable r)

Makes current the "shared" OpenGL context associated with the given GraphicsConfiguration object, allowing JOGL to share server-side OpenGL objects like textures and display lists with this context when necessary.

public static boolean
public static boolean
public static boolean
public static boolean
public static boolean
makeOGLContextCurrentOnSurface(final Graphics g, final long ctx)

(Mac OS X-specific) Makes the given OpenGL context current on the surface associated with the given Graphics object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

createOGLContextOnSurfaceMethodback to summary
private static Method createOGLContextOnSurfaceMethod
DEBUGback to summary
private static boolean DEBUG
destroyOGLContextMethodback to summary
private static Method destroyOGLContextMethod
FBOBJECTback to summary
public static final int FBOBJECT
fbObjectSupportInitializedback to summary
private static boolean fbObjectSupportInitialized
FLIP_BACKBUFFERback to summary
public static final int FLIP_BACKBUFFER
getOGLScissorBoxMethodback to summary
private static Method getOGLScissorBoxMethod
getOGLSurfaceIdentifierMethodback to summary
private static Method getOGLSurfaceIdentifierMethod
getOGLSurfaceTypeMethodback to summary
private static Method getOGLSurfaceTypeMethod
getOGLTextureTypeMethodback to summary
private static Method getOGLTextureTypeMethod
getOGLViewportMethodback to summary
private static Method getOGLViewportMethod
initializedJ2DFBOShareContextback to summary
private static boolean initializedJ2DFBOShareContext
invokeWithOGLContextCurrentMethodback to summary
private static Method invokeWithOGLContextCurrentMethod
invokeWithOGLSharedContextCurrentMethodback to summary
private static Method invokeWithOGLSharedContextCurrentMethod
isHeadlessback to summary
private static boolean isHeadless
isOGLPipelineActiveback to summary
private static boolean isOGLPipelineActive
isOGLPipelineResourceCompatibleback to summary
private static boolean isOGLPipelineResourceCompatible
isQueueFlusherThreadMethodback to summary
private static Method isQueueFlusherThreadMethod
j2dFBOShareContextback to summary
private static GLContext j2dFBOShareContext
makeOGLContextCurrentOnSurfaceMethodback to summary
private static Method makeOGLContextCurrentOnSurfaceMethod
PBUFFERback to summary
public static final int PBUFFER
TEXTUREback to summary
public static final int TEXTURE
UNDEFINEDback to summary
public static final int UNDEFINED
WINDOWback to summary
public static final int WINDOW

Constructor Detail

Java2Dback to summary
public Java2D()

Method Detail

checkActiveback to summary
private static void checkActive()
checkCompatibleback to summary
private static void checkCompatible()
createOGLContextOnSurfaceback to summary
public static long createOGLContextOnSurface(final Graphics g, final long shareCtx)

(Mac OS X-specific) Creates a new OpenGL context on the surface associated with the given Graphics object, sharing textures and display lists with the specified (CGLContextObj) share context.

destroyOGLContextback to summary
public static void destroyOGLContext(final long ctx)

(Mac OS X-specific) Destroys the given OpenGL context.

filterShareContextback to summary
public static GLContext filterShareContext(final GLContext shareContext)

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 used for rendering. FIXME: may need to alter the API in the future to indicate which GraphicsDevice the source context is associated with.

getOGLScissorBoxback to summary
public static Rectangle getOGLScissorBox(final Graphics g)

Returns the OpenGL scissor region associated with the given Graphics object, taking into account all clipping regions, etc. To avoid destroying Java2D's previous rendering results, this method should be called and the resulting rectangle's bounds passed to a call to glScissor(). Should only be called from the Queue Flusher Thread.

getOGLSurfaceIdentifierback to summary
public static Object getOGLSurfaceIdentifier(final Graphics g)

Returns an opaque "surface identifier" associated with the given Graphics object. If this changes from invocation to invocation, the underlying OpenGL drawable for the Graphics object has changed and a new external GLDrawable and GLContext should be created (and the old ones destroyed). Should only be called from the Queue Flusher Thread.

getOGLSurfaceTypeback to summary
public static int getOGLSurfaceType(final Graphics g)

Returns the underlying surface type for the given Graphics object. This indicates, in particular, whether Java2D is currently rendering into a pbuffer or FBO.

getOGLTextureTypeback to summary
public static int getOGLTextureType(final Graphics g)

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.

getOGLUtilitiesIntFieldback to summary
private static int getOGLUtilitiesIntField(final String name)
getOGLViewportback to summary
public static Rectangle getOGLViewport(final Graphics g, final int componentWidth, final int componentHeight)

Returns the OpenGL viewport associated with the given Graphics object, assuming that the Graphics object is associated with a component of the specified width and height. The user should call glViewport() with the returned rectangle's bounds in order to get correct rendering results. Should only be called from the Queue Flusher Thread.

getShareContextback to summary
public static GLContext getShareContext(final GraphicsDevice device)

Returns the GLContext associated with the Java2D "share context", with which all contexts created by JOGL must share textures and display lists when the FBO option is enabled for the Java2D/OpenGL pipeline.

initFBOShareContextback to summary
private static void initFBOShareContext(final GraphicsDevice device)
invokeWithOGLContextCurrentback to summary
public static void invokeWithOGLContextCurrent(final Graphics g, final Runnable r) throws GLException

Makes current the OpenGL context associated with the passed Graphics object and runs the given Runnable on the Queue Flushing Thread in one atomic action.

invokeWithOGLSharedContextCurrentback to summary
public static boolean invokeWithOGLSharedContextCurrent(final GraphicsConfiguration g, final Runnable r) throws GLException

Makes current the "shared" OpenGL context associated with the given GraphicsConfiguration object, allowing JOGL to share server-side OpenGL objects like textures and display lists with this context when necessary. This is needed when Java2D's FBO support is enabled, because in order to render into that FBO, JOGL must share textures and display lists with it. Returns false if the passed GraphicsConfiguration was not an OpenGL GraphicsConfiguration.

isFBOEnabledback to summary
public static boolean isFBOEnabled()
isOGLPipelineActiveback to summary
public static boolean isOGLPipelineActive()
isOGLPipelineResourceCompatibleback to summary
public static boolean isOGLPipelineResourceCompatible()
isQueueFlusherThreadback to summary
public static boolean isQueueFlusherThread()
makeOGLContextCurrentOnSurfaceback to summary
public static boolean makeOGLContextCurrentOnSurface(final Graphics g, final long ctx)

(Mac OS X-specific) Makes the given OpenGL context current on the surface associated with the given Graphics object.