Aviatrix3D
2.1.0

org.j3d.aviatrix3d.output.graphics
Class BaseBufferDescriptor

java.lang.Object
  extended by org.j3d.aviatrix3d.output.graphics.BaseBufferDescriptor
All Implemented Interfaces:
OffscreenBufferDescriptor

public abstract class BaseBufferDescriptor
extends java.lang.Object
implements OffscreenBufferDescriptor

Common basic descriptor for all the different types of buffer implementations.

A descriptor at this level abstracts away most of the basic interactions that rendering code needs to perform. Not all the methods need to do something, as the different types of buffers will have varying implementation requirements.

GLContext usage

Buffers have two GLContext scopes. The first is the GLContext instance that this buffer is created under. The second GLContext is the local context that renders within that buffer. For example, you have a main scene with the parent context and then a Pbuffer will have its own separate local context. However, the lines can become blurred when looking at other buffer types, such as FBOs. In that case, the local and parent context are the same reference. However, at the conceptual level, the buffer descriptor makes this distinction.

Most methods will use the parent context as that is needed to operate buffer control. Where needed, the end user code can extract the local context.

Version:
$Revision: 3.6 $
Author:
Justin Couch

Field Summary
protected  int bufferHeight
          The current height of the buffer in pixels
protected  int bufferWidth
          The current width of the buffer in pixels
protected  boolean initComplete
          Flag indicating the current initialisation state
protected  OffscreenBufferRenderable ownerRenderable
          The renderable object that we are representing as a buffer
 
Constructor Summary
protected BaseBufferDescriptor(OffscreenBufferRenderable owner)
          Construct an instance of this class that will contain a buffer with the requested capabilties.
 
Method Summary
 void bindBuffer(javax.media.opengl.GLContext parentContext)
          Bind the current buffer to this context now.
abstract  void delete(javax.media.opengl.GLContext context)
          Remove this buffer object from existance.
abstract  void disable(javax.media.opengl.GLContext context)
          This buffer is no longer eligable for rendering to now.
abstract  EnableState enable(javax.media.opengl.GLContext context)
          Enable this buffer for rendering to now.
abstract  javax.media.opengl.GLContext getLocalContext()
          Fetch the local context for this buffer.
abstract  boolean initialise(javax.media.opengl.GLContext parentContext)
          Initialise an instance of this buffer now within the given parent context.
 boolean isInitialised()
          Check to see if this buffer has been initialised yet.
abstract  void reinitialize()
          Reinitialise this descriptor because the GL context has changed.
abstract  void resize(javax.media.opengl.GLContext context)
          Resize the underlying textures, leaving the buffer ID intact.
abstract  void swapBuffers(javax.media.opengl.GLContext context)
          Finish rendering this buffer and copy it in to the destination texture.
 void unbindBuffer(javax.media.opengl.GLContext parentContext)
          Unbind the current buffer from this context now.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initComplete

protected boolean initComplete
Flag indicating the current initialisation state


ownerRenderable

protected OffscreenBufferRenderable ownerRenderable
The renderable object that we are representing as a buffer


bufferWidth

protected int bufferWidth
The current width of the buffer in pixels


bufferHeight

protected int bufferHeight
The current height of the buffer in pixels

Constructor Detail

BaseBufferDescriptor

protected BaseBufferDescriptor(OffscreenBufferRenderable owner)
Construct an instance of this class that will contain a buffer with the requested capabilties.

Parameters:
owner - The renderable that we are wrapping
Method Detail

isInitialised

public boolean isInitialised()
Check to see if this buffer has been initialised yet.

Returns:
True if it has been initialised, false for not

initialise

public abstract boolean initialise(javax.media.opengl.GLContext parentContext)
Initialise an instance of this buffer now within the given parent context.

Parameters:
parentContext - The parent context to create the buffer in
Returns:
boolean true if initialisation succeeded for this buffer false if it was not possible or had an error when creating this buffer type.

reinitialize

public abstract void reinitialize()
Reinitialise this descriptor because the GL context has changed.


getLocalContext

public abstract javax.media.opengl.GLContext getLocalContext()
Fetch the local context for this buffer. If the buffer has not yet been initialised, this will return null.

Returns:
The context for the buffer, or null

enable

public abstract EnableState enable(javax.media.opengl.GLContext context)
                            throws javax.media.opengl.GLException
Enable this buffer for rendering to now. A buffer may fail to enable depending on the state of the underlying buffer. The state object describes the options available.

Parameters:
context - The GL context this buffer comes from
Returns:
The state that the enabling departed in
Throws:
javax.media.opengl.GLException - Exception when something at the low-level went wrong.

disable

public abstract void disable(javax.media.opengl.GLContext context)
                      throws javax.media.opengl.GLException
This buffer is no longer eligable for rendering to now.

Parameters:
context - The GL context this buffer comes from
Throws:
javax.media.opengl.GLException - Exception when something at the low-level went wrong.

bindBuffer

public void bindBuffer(javax.media.opengl.GLContext parentContext)
Bind the current buffer to this context now. Default implementation does nothing. Override for the pbuffer render-to-texture-specific case.


unbindBuffer

public void unbindBuffer(javax.media.opengl.GLContext parentContext)
Unbind the current buffer from this context now. Default implementation does nothing. Override for the pbuffer render-to-texture-specific case.


swapBuffers

public abstract void swapBuffers(javax.media.opengl.GLContext context)
Finish rendering this buffer and copy it in to the destination texture.

Parameters:
context - The GL context this buffer comes from

resize

public abstract void resize(javax.media.opengl.GLContext context)
Resize the underlying textures, leaving the buffer ID intact.

Parameters:
context - The GL context this buffer comes from

delete

public abstract void delete(javax.media.opengl.GLContext context)
Remove this buffer object from existance. Will delete the handle that OpenGL has and turns it back to uninitialised.

Parameters:
context - The GL context this buffer comes from

Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org