com.threerings.opengl.renderer
Class Framebuffer

java.lang.Object
  extended by com.threerings.opengl.renderer.Framebuffer

public class Framebuffer
extends Object

An OpenGL frame buffer object.


Field Summary
protected  Object _colorAttachment
          The texture or render buffer attached to the color target.
protected  int _colorLevel
          The mipmap level and parameter of the texture attached to the color target.
protected  int _colorParam
          The mipmap level and parameter of the texture attached to the color target.
protected  Object _depthAttachment
          The texture or render buffer attached to the depth target.
protected  int _depthLevel
          The mipmap level and parameter of the texture attached to the depth target.
protected  int _depthParam
          The mipmap level and parameter of the texture attached to the depth target.
protected  int _id
          The OpenGL identifier for the frame buffer.
protected  Renderer _renderer
          The renderer responsible for this frame buffer.
protected  Object _stencilAttachment
          The texture or render buffer attached to the stencil target.
protected  int _stencilLevel
          The mipmap level and parameter of the texture attached to the stencil target.
protected  int _stencilParam
          The mipmap level and parameter of the texture attached to the stencil target.
 
Constructor Summary
Framebuffer(Renderer renderer)
          Creates a frame buffer object for the specified renderer.
 
Method Summary
 int checkStatus()
          Checks the status of the frame buffer.
 void delete()
          Deletes this frame buffer, rendering it unusable.
protected  void finalize()
           
 Object getColorAttachment()
          Returns a reference to the color target of this frame buffer (either a Texture or a Renderbuffer, or null).
 Object getDepthAttachment()
          Returns a reference to the depth target of this frame buffer (either a Texture or a Renderbuffer, or null).
 int getId()
          Returns this frame buffer's OpenGL identifier.
 Object getStencilAttachment()
          Returns a reference to the stencil target of this frame buffer (either a Texture or a Renderbuffer, or null).
 boolean isComplete()
          Checks whether the frame buffer is "complete."
protected  void setAttachment(int attachment, Renderbuffer renderbuffer)
          Attaches a render buffer to this frame buffer at the specified attachment point.
protected  void setAttachment(int attachment, Texture texture, int level, int param)
          Attaches a texture to this frame buffer at the specified attachment point.
 void setColorAttachment(Renderbuffer renderbuffer)
          Attaches a render buffer to the color target of this frame buffer.
 void setColorAttachment(Texture texture)
          Attaches a texture to the color target of this frame buffer.
 void setColorAttachment(Texture texture, int level, int param)
          Attaches a texture to the color target of this frame buffer.
 void setDepthAttachment(Renderbuffer renderbuffer)
          Attaches a render buffer to the depth target of this frame buffer.
 void setDepthAttachment(Texture texture)
          Attaches a texture to the depth target of this frame buffer.
 void setDepthAttachment(Texture texture, int level, int param)
          Attaches a texture to the depth target of this frame buffer.
 void setStencilAttachment(Renderbuffer renderbuffer)
          Attaches a render buffer to the stencil target of this frame buffer.
 void setStencilAttachment(Texture texture)
          Attaches a texture to the stencil target of this frame buffer.
 void setStencilAttachment(Texture texture, int level, int param)
          Attaches a texture to the stencil target of this frame buffer.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_renderer

protected Renderer _renderer
The renderer responsible for this frame buffer.


_id

protected int _id
The OpenGL identifier for the frame buffer.


_colorAttachment

protected Object _colorAttachment
The texture or render buffer attached to the color target.


_colorLevel

protected int _colorLevel
The mipmap level and parameter of the texture attached to the color target.


_colorParam

protected int _colorParam
The mipmap level and parameter of the texture attached to the color target.


_depthAttachment

protected Object _depthAttachment
The texture or render buffer attached to the depth target.


_depthLevel

protected int _depthLevel
The mipmap level and parameter of the texture attached to the depth target.


_depthParam

protected int _depthParam
The mipmap level and parameter of the texture attached to the depth target.


_stencilAttachment

protected Object _stencilAttachment
The texture or render buffer attached to the stencil target.


_stencilLevel

protected int _stencilLevel
The mipmap level and parameter of the texture attached to the stencil target.


_stencilParam

protected int _stencilParam
The mipmap level and parameter of the texture attached to the stencil target.

Constructor Detail

Framebuffer

public Framebuffer(Renderer renderer)
Creates a frame buffer object for the specified renderer.

Method Detail

getId

public final int getId()
Returns this frame buffer's OpenGL identifier.


setColorAttachment

public void setColorAttachment(Texture texture)
Attaches a texture to the color target of this frame buffer.


setColorAttachment

public void setColorAttachment(Texture texture,
                               int level,
                               int param)
Attaches a texture to the color target of this frame buffer.

Parameters:
level - the mipmap level.
param - for depth textures, the z offset; for cube map textures, the face index.

setColorAttachment

public void setColorAttachment(Renderbuffer renderbuffer)
Attaches a render buffer to the color target of this frame buffer.


getColorAttachment

public Object getColorAttachment()
Returns a reference to the color target of this frame buffer (either a Texture or a Renderbuffer, or null).


setDepthAttachment

public void setDepthAttachment(Texture texture)
Attaches a texture to the depth target of this frame buffer.


setDepthAttachment

public void setDepthAttachment(Texture texture,
                               int level,
                               int param)
Attaches a texture to the depth target of this frame buffer.

Parameters:
level - the mipmap level.
param - for depth textures, the z offset; for cube map textures, the face index.

setDepthAttachment

public void setDepthAttachment(Renderbuffer renderbuffer)
Attaches a render buffer to the depth target of this frame buffer.


getDepthAttachment

public Object getDepthAttachment()
Returns a reference to the depth target of this frame buffer (either a Texture or a Renderbuffer, or null).


setStencilAttachment

public void setStencilAttachment(Texture texture)
Attaches a texture to the stencil target of this frame buffer.


setStencilAttachment

public void setStencilAttachment(Texture texture,
                                 int level,
                                 int param)
Attaches a texture to the stencil target of this frame buffer.

Parameters:
level - the mipmap level.
param - for depth textures, the z offset; for cube map textures, the face index.

setStencilAttachment

public void setStencilAttachment(Renderbuffer renderbuffer)
Attaches a render buffer to the stencil target of this frame buffer.


getStencilAttachment

public Object getStencilAttachment()
Returns a reference to the stencil target of this frame buffer (either a Texture or a Renderbuffer, or null).


isComplete

public boolean isComplete()
Checks whether the frame buffer is "complete."


checkStatus

public int checkStatus()
Checks the status of the frame buffer.


delete

public void delete()
Deletes this frame buffer, rendering it unusable.


setAttachment

protected void setAttachment(int attachment,
                             Texture texture,
                             int level,
                             int param)
Attaches a texture to this frame buffer at the specified attachment point.

Parameters:
level - the mipmap level.
param - depending on the texture type, either the 3D texture z offset or the cube map face index.

setAttachment

protected void setAttachment(int attachment,
                             Renderbuffer renderbuffer)
Attaches a render buffer to this frame buffer at the specified attachment point.


finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable