maspack.render
Class FrameBufferObject

java.lang.Object
  extended by maspack.render.FrameBufferObject

public class FrameBufferObject
extends java.lang.Object


Field Summary
static int ActiveFBO
           
 int CBhandle
           
 int CBNhandle
           
 int DBhandle
           
static int defaultSamples
           
 int FBNhandle
           
 int FBOhandle
           
 java.io.File file
           
 java.lang.String format
           
 javax.media.opengl.GL2 gl
           
 int height
           
 int samples
           
 boolean setup
           
static int SIZE_INT
           
 int width
           
 int x
           
 int y
           
 
Constructor Summary
FrameBufferObject(int w, int h, java.io.File file, java.lang.String format, javax.media.opengl.GL2 gl)
          Create a framebuffer with the given dimensions
FrameBufferObject(int x, int y, int w, int h, java.io.File file, java.lang.String format, javax.media.opengl.GL2 gl)
          Create a framebuffer with the given dimensions
 
Method Summary
 void activate()
          Once activated() all further rendering will go to the framebuffer object.
 void capture()
          Captures an image of the canvas and saves it to the specified file.
 int checkStatus()
          Return the error code from the FBO
 void cleanup()
          delete the framebufferobject and renderbufferobject
 void deactivate()
          Once deactivated all further rendering goes to the screen.
static java.lang.String framebuffer_status_string(int statcode)
          Return a string representing the given fbo status code
 void setupFBO()
          Prepare framebuffer for use.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ActiveFBO

public static int ActiveFBO

defaultSamples

public static int defaultSamples

FBOhandle

public int FBOhandle

DBhandle

public int DBhandle

CBhandle

public int CBhandle

FBNhandle

public int FBNhandle

CBNhandle

public int CBNhandle

x

public int x

y

public int y

width

public int width

height

public int height

SIZE_INT

public static final int SIZE_INT
See Also:
Constant Field Values

gl

public javax.media.opengl.GL2 gl

file

public java.io.File file

format

public java.lang.String format

setup

public boolean setup

samples

public int samples
Constructor Detail

FrameBufferObject

public FrameBufferObject(int w,
                         int h,
                         java.io.File file,
                         java.lang.String format,
                         javax.media.opengl.GL2 gl)
Create a framebuffer with the given dimensions


FrameBufferObject

public FrameBufferObject(int x,
                         int y,
                         int w,
                         int h,
                         java.io.File file,
                         java.lang.String format,
                         javax.media.opengl.GL2 gl)
Create a framebuffer with the given dimensions

Method Detail

setupFBO

public void setupFBO()
Prepare framebuffer for use. Width and height should be set to rational values before calling this function. Creates framebuffer with depth buffer and one texture.


checkStatus

public int checkStatus()
Return the error code from the FBO


framebuffer_status_string

public static java.lang.String framebuffer_status_string(int statcode)
Return a string representing the given fbo status code


activate

public void activate()
Once activated() all further rendering will go to the framebuffer object. This function sets the viewport to the width and height of the FBO. The deactivate() function will return the viewport to it's previous setting and turn off the FBO. To use:
      FBO.activate();
      .....   // draw something here
      FBO.deactivate();
 

See Also:
deactivate()

deactivate

public void deactivate()
Once deactivated all further rendering goes to the screen. The viewport is returned to its previous setting (before activate() was called).

See Also:
activate()

cleanup

public void cleanup()
delete the framebufferobject and renderbufferobject


capture

public void capture()
Captures an image of the canvas and saves it to the specified file.