com.metsci.glimpse.canvas
Class FrameBufferGlimpseCanvas

java.lang.Object
  extended by com.metsci.glimpse.canvas.FrameBufferGlimpseCanvas
All Implemented Interfaces:
GlimpseCanvas, GlimpseTarget

public class FrameBufferGlimpseCanvas
extends java.lang.Object
implements GlimpseCanvas

An offscreen GlimpseCanvas which renders its GlimpsePainters onto an OpenGL texture which can then be captured and displayed elsewhere.

Author:
ulman

Nested Class Summary
static interface FrameBufferGlimpseCanvas.GlimpseRunnable
           
 
Constructor Summary
FrameBufferGlimpseCanvas(int width, int height, javax.media.opengl.GLContext context)
           
 
Method Summary
 void addLayout(GlimpseLayout layout)
          Adds a sub-layout to this GlimpseTarget which will only paint in a region of this GlimpseTarget based on its layout constraints.
 void dispose()
          Disposes of any native resources associated with the GlimpseCanvas.
 java.awt.Dimension getDimension()
           
 GLSimpleFrameBufferObject getFrameBuffer()
           
 javax.media.opengl.GLContext getGLContext()
           
 GlimpseContext getGlimpseContext()
           
 DrawableTexture getGlimpseTexture()
           
 com.sun.opengl.util.texture.Texture getOpenGLTexture()
           
 GlimpseBounds getTargetBounds()
           
 GlimpseBounds getTargetBounds(GlimpseTargetStack stack)
          Returns the cached or calculated bounds of this GlimpseTarget for a particular context.
 java.util.List<GlimpseTarget> getTargetChildren()
           
 void glSyncExec(FrameBufferGlimpseCanvas.GlimpseRunnable runnable)
           
 boolean isDisposed()
           
 boolean isEventConsumer()
          Sets whether this GlimpseTarget hides events from GlimpseTargets under it.
 boolean isEventGenerator()
          Sets whether this GlimpseTarget generates GlimpseMouseEvents.
 void paint()
          Lays out any GlimpseLayout instances attached to the GlimpseCanvas and paints all GlimpsePainter instances attached to the GlimpseLayouts.
 void removeAllLayouts()
           
 void removeLayout(GlimpseLayout layout)
          Removes a previously added layout from this GlimpseTarget.
 void resize(int new_width, int new_height)
           
 void setEventConsumer(boolean consume)
          Set whether or not this GlimpseTarget will consume or pass through mouse events.
 void setEventGenerator(boolean generate)
          Set whether or not this GlimpseTarget will generate GlimpseMouseEvents.
 void setLookAndFeel(LookAndFeel laf)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FrameBufferGlimpseCanvas

public FrameBufferGlimpseCanvas(int width,
                                int height,
                                javax.media.opengl.GLContext context)
Method Detail

resize

public void resize(int new_width,
                   int new_height)

getFrameBuffer

public GLSimpleFrameBufferObject getFrameBuffer()

getOpenGLTexture

public com.sun.opengl.util.texture.Texture getOpenGLTexture()

getGlimpseTexture

public DrawableTexture getGlimpseTexture()

getDimension

public java.awt.Dimension getDimension()

glSyncExec

public void glSyncExec(FrameBufferGlimpseCanvas.GlimpseRunnable runnable)

getGlimpseContext

public GlimpseContext getGlimpseContext()
Specified by:
getGlimpseContext in interface GlimpseCanvas

setLookAndFeel

public void setLookAndFeel(LookAndFeel laf)
Specified by:
setLookAndFeel in interface GlimpseTarget

getGLContext

public javax.media.opengl.GLContext getGLContext()
Specified by:
getGLContext in interface GlimpseCanvas

getTargetBounds

public GlimpseBounds getTargetBounds(GlimpseTargetStack stack)
Description copied from interface: GlimpseTarget
Returns the cached or calculated bounds of this GlimpseTarget for a particular context.

Specified by:
getTargetBounds in interface GlimpseTarget
Returns:
the bounds for the given stack

getTargetBounds

public GlimpseBounds getTargetBounds()
Specified by:
getTargetBounds in interface GlimpseCanvas

addLayout

public void addLayout(GlimpseLayout layout)
Description copied from interface: GlimpseTarget
Adds a sub-layout to this GlimpseTarget which will only paint in a region of this GlimpseTarget based on its layout constraints. This same GlimpseLayout may be a child of any number of different GlimpseTargets.

Specified by:
addLayout in interface GlimpseTarget

removeLayout

public void removeLayout(GlimpseLayout layout)
Description copied from interface: GlimpseTarget
Removes a previously added layout from this GlimpseTarget.

Specified by:
removeLayout in interface GlimpseTarget

removeAllLayouts

public void removeAllLayouts()

getTargetChildren

public java.util.List<GlimpseTarget> getTargetChildren()
Specified by:
getTargetChildren in interface GlimpseTarget
Returns:
the list of children added through addLayout( GlimpseLayout ).

paint

public void paint()
Description copied from interface: GlimpseCanvas
Lays out any GlimpseLayout instances attached to the GlimpseCanvas and paints all GlimpsePainter instances attached to the GlimpseLayouts.

Specified by:
paint in interface GlimpseCanvas

dispose

public void dispose()
Description copied from interface: GlimpseCanvas
Disposes of any native resources associated with the GlimpseCanvas.

Specified by:
dispose in interface GlimpseCanvas

isDisposed

public boolean isDisposed()
Specified by:
isDisposed in interface GlimpseCanvas
Returns:
whether or not dispose() has been successfully called. Once true, this GlimpseCanvas is no longer valid for rendering.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isEventConsumer

public boolean isEventConsumer()
Description copied from interface: GlimpseTarget
Sets whether this GlimpseTarget hides events from GlimpseTargets under it. This value does not determine whether or not the GlimpseTarget will generate GlimpseMouseEvents (see {@link #isEventGenerator()).

Specified by:
isEventConsumer in interface GlimpseTarget
Returns:
whether this target hides events from targets under it

setEventConsumer

public void setEventConsumer(boolean consume)
Description copied from interface: GlimpseTarget
Set whether or not this GlimpseTarget will consume or pass through mouse events.

Specified by:
setEventConsumer in interface GlimpseTarget

isEventGenerator

public boolean isEventGenerator()
Description copied from interface: GlimpseTarget
Sets whether this GlimpseTarget generates GlimpseMouseEvents. This value does not determine whether or not GlimpseTargets underneath this GlimpseTarget will also generate GlimpseMouseEvents (see GlimpseTarget.isEventConsumer()).

Specified by:
isEventGenerator in interface GlimpseTarget
Returns:
whether this target will generate GlimpseMouseEvents

setEventGenerator

public void setEventGenerator(boolean generate)
Description copied from interface: GlimpseTarget
Set whether or not this GlimpseTarget will generate GlimpseMouseEvents.

Specified by:
setEventGenerator in interface GlimpseTarget


Copyright © 2012 Metron, Inc.. All Rights Reserved.