j3d.org OpenGL SWT Bindings

org.j3d.opengl.swt
Class SWTRIDrawableFactory

java.lang.Object
  extended byGLDrawableFactory
      extended byorg.j3d.opengl.swt.SWTRIDrawableFactory

public class SWTRIDrawableFactory
extends GLDrawableFactory

An implementation of the GLDrawableFactory that generates SWT-specific capabilities using an extension of the JOGL Reference Implementation codebase.

Version:
$Revision: 1.1 $
Author:
Justin Couch
See Also:
Serialized Form

Constructor Summary
SWTRIDrawableFactory()
          Create a new instance of this drawable factory.
 
Method Summary
 boolean canCreateExternalGLDrawable()
          Check to see if this card can create a drawable instance using an external GL context.
 boolean canCreateGLPbuffer()
          Check to see if this system is capable of creating a Pbuffer.
 AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, GLCapabilitiesChooser chooser, AbstractGraphicsDevice device)
          Selects a graphics configuration on the specified graphics device compatible with the supplied GLCapabilities.
 GLContext createExternalGLContext()
           Creates a GLContext object representing an existing OpenGL context in an external (third-party) OpenGL-based library.
 GLDrawable createExternalGLDrawable()
          Create a GLDrawable object representing an existing OpenGL drawable in an external (third-party) OpenGL-based library.
 GLPbuffer createGLPbuffer(GLCapabilities capabilities, int initialWidth, int initialHeight, GLContext shareWith)
          Creates a GLPbuffer with the given capabilites and dimensions.
 GLDrawable getGLDrawable(java.lang.Object target, GLCapabilities capabilities, GLCapabilitiesChooser chooser)
          Returns a GLDrawable that wraps a platform-specific window system object, such as an AWT or LCDUI Canvas.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWTRIDrawableFactory

public SWTRIDrawableFactory()
Create a new instance of this drawable factory. Note that end users should never call this method directly. It is made public so that the dynamic class loading defined by the specification can load this package from another class in a different package.

Method Detail

chooseGraphicsConfiguration

public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
                                                                 GLCapabilitiesChooser chooser,
                                                                 AbstractGraphicsDevice device)
Selects a graphics configuration on the specified graphics device compatible with the supplied GLCapabilities.

The concrete data type of the passed graphics device and returned graphics configuration must be specified in the documentation binding this particular API to the underlying window toolkit. The SWT implementation accepts SWTGraphicsDevice objects and returns SWTGraphicsConfiguration objects.


getGLDrawable

public GLDrawable getGLDrawable(java.lang.Object target,
                                GLCapabilities capabilities,
                                GLCapabilitiesChooser chooser)
                         throws java.lang.IllegalArgumentException,
                                GLException
Returns a GLDrawable that wraps a platform-specific window system object, such as an AWT or LCDUI Canvas. On platforms which support it, selects a pixel format compatible with the supplied GLCapabilities, or if the passed GLCapabilities object is null, uses a default set of capabilities. On these platforms, uses either the supplied GLCapabilitiesChooser object, or if the passed GLCapabilitiesChooser object is null, uses a DefaultGLCapabilitiesChooser instance.

Throws:
java.lang.IllegalArgumentException - if the passed target is either null or its data type is not supported by this GLDrawableFactory.
GLException - if any window system-specific errors caused the creation of the GLDrawable to fail.

canCreateGLPbuffer

public boolean canCreateGLPbuffer()
Check to see if this system is capable of creating a Pbuffer. Some older graphics cards are not capable of this.

Returns:
true if it is possible to create a GLPbuffer.

createGLPbuffer

public GLPbuffer createGLPbuffer(GLCapabilities capabilities,
                                 int initialWidth,
                                 int initialHeight,
                                 GLContext shareWith)
Creates a GLPbuffer with the given capabilites and dimensions.


createExternalGLContext

public GLContext createExternalGLContext()

Creates a GLContext object representing an existing OpenGL context in an external (third-party) OpenGL-based library. This GLContext object may be used to draw into this preexisting context using its GL and javax.media.opengl.glu.GLU objects. New contexts created through GLDrawables may share textures and display lists with this external context.

The underlying OpenGL context must be current on the current thread at the time this method is called. The user is responsible for the maintenance of the underlying OpenGL context; calls to makeCurrent and release on the returned GLContext object have no effect. If the underlying OpenGL context is destroyed, the destroy method should be called on the GLContext. A new GLContext object should be created for each newly-created underlying OpenGL context.


canCreateExternalGLDrawable

public boolean canCreateExternalGLDrawable()
Check to see if this card can create a drawable instance using an external GL context.

Returns:
true if it is possible to create an external GLDrawable object via createExternalGLDrawable().

createExternalGLDrawable

public GLDrawable createExternalGLDrawable()
Create a GLDrawable object representing an existing OpenGL drawable in an external (third-party) OpenGL-based library. This GLDrawable object may be used to create new, fully-functional GLContexts on the OpenGL drawable. This is useful when interoperating with a third-party OpenGL-based library and it is essential to not perturb the state of the library's existing context, even to the point of not sharing textures or display lists with that context.


j3d.org OpenGL SWT Bindings

Latest Info from http://www.j3d.org/
Copyright © 2003 - 2005 j3d.org