com.sun.opengl.impl
Class Java2D

java.lang.Object
  extended by com.sun.opengl.impl.Java2D

public class Java2D
extends java.lang.Object

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


Field Summary
static int FBOBJECT
           
static int FLIP_BACKBUFFER
           
static int PBUFFER
           
static int TEXTURE
           
static int UNDEFINED
           
static int WINDOW
           
 
Constructor Summary
Java2D()
           
 
Method Summary
static long createOGLContextOnSurface(java.awt.Graphics g, 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.
static void destroyOGLContext(long ctx)
          (Mac OS X-specific) Destroys the given OpenGL context.
static GLContext filterShareContext(GLContext shareContext)
          Returns either the given GLContext or a substitute one with which clients should share textures and display lists.
static java.awt.Rectangle getOGLScissorBox(java.awt.Graphics g)
          Returns the OpenGL scissor region associated with the given Graphics object, taking into account all clipping regions, etc.
static java.lang.Object getOGLSurfaceIdentifier(java.awt.Graphics g)
          Returns an opaque "surface identifier" associated with the given Graphics object.
static int getOGLSurfaceType(java.awt.Graphics g)
          Returns the underlying surface type for the given Graphics object.
static int getOGLTextureType(java.awt.Graphics g)
          Returns the underlying texture target of the given Graphics object assuming it is rendering to an FBO.
static java.awt.Rectangle getOGLViewport(java.awt.Graphics g, int componentWidth, 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.
static GLContext getShareContext(java.awt.GraphicsConfiguration gc)
          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.
static void invokeWithOGLContextCurrent(java.awt.Graphics g, java.lang.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.
static boolean invokeWithOGLSharedContextCurrent(java.awt.GraphicsConfiguration g, java.lang.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.
static boolean isFBOEnabled()
           
static boolean isOGLPipelineActive()
           
static boolean isQueueFlusherThread()
           
static boolean makeOGLContextCurrentOnSurface(java.awt.Graphics g, long ctx)
          (Mac OS X-specific) Makes the given OpenGL context current on the surface associated with the given Graphics object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED

WINDOW

public static final int WINDOW

PBUFFER

public static final int PBUFFER

TEXTURE

public static final int TEXTURE

FLIP_BACKBUFFER

public static final int FLIP_BACKBUFFER

FBOBJECT

public static final int FBOBJECT
Constructor Detail

Java2D

public Java2D()
Method Detail

isOGLPipelineActive

public static boolean isOGLPipelineActive()

isFBOEnabled

public static boolean isFBOEnabled()

isQueueFlusherThread

public static boolean isQueueFlusherThread()

invokeWithOGLContextCurrent

public static void invokeWithOGLContextCurrent(java.awt.Graphics g,
                                               java.lang.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.

Throws:
GLException

invokeWithOGLSharedContextCurrent

public static boolean invokeWithOGLSharedContextCurrent(java.awt.GraphicsConfiguration g,
                                                        java.lang.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.

Throws:
GLException

getOGLViewport

public static java.awt.Rectangle getOGLViewport(java.awt.Graphics g,
                                                int componentWidth,
                                                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.


getOGLScissorBox

public static java.awt.Rectangle getOGLScissorBox(java.awt.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.


getOGLSurfaceIdentifier

public static java.lang.Object getOGLSurfaceIdentifier(java.awt.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.


getOGLSurfaceType

public static int getOGLSurfaceType(java.awt.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.


getOGLTextureType

public static int getOGLTextureType(java.awt.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.


filterShareContext

public static GLContext filterShareContext(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.


getShareContext

public static GLContext getShareContext(java.awt.GraphicsConfiguration gc)
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.


createOGLContextOnSurface

public static long createOGLContextOnSurface(java.awt.Graphics g,
                                             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.


makeOGLContextCurrentOnSurface

public static boolean makeOGLContextCurrentOnSurface(java.awt.Graphics g,
                                                     long ctx)
(Mac OS X-specific) Makes the given OpenGL context current on the surface associated with the given Graphics object.


destroyOGLContext

public static void destroyOGLContext(long ctx)
(Mac OS X-specific) Destroys the given OpenGL context.



Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.