RE_OGLFramebuffer Class Reference

#include <RE_OGLFramebuffer.h>

List of all members.

Public Types

enum  RE_BufferBindMode { RE_BIND_NONE = 0, RE_BIND_READ = 1, RE_BIND_DRAW = 2 }

Public Member Functions

 RE_OGLFramebuffer (const char *name=NULL)
 ~RE_OGLFramebuffer ()
const char * getName ()
bool attachTexture (RE_Render *r, RE_Texture *t, int level=-1, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0)
RE_TexturecreateTexture (RE_Render *r, RE_GPUType type, int vectorsize, int miplevel=-1, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0, bool rect=false, int samples=0)
RE_OGLRenderbuffercreateRenderbuffer (RE_Render *r, RE_GPUType type, int vectorsize, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0, int samples=0)
bool attachRenderbuffer (RE_Render *r, RE_OGLRenderbuffer *rbuf, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0)
bool hasAttachment (RE_BufferAttachment buf, int colorbufnum=0)
bool isTextureAttachment (RE_BufferAttachment buf, int colorbufnum=0)
RE_OGLRenderbuffergetBufferAttachment (RE_BufferAttachment buf, int colorbufnum=0)
RE_TexturegetTextureAttachment (RE_BufferAttachment buf, int colorbufnum=0)
bool verifyBufferAttachment (RE_Render *r, RE_BufferAttachment buf, int colorbufnum=0, RE_FBOStatus *status=NULL)
 Returns true if an attachment if framebuffer-complete.
void setResolution (int width, int height)
int getWidth () const
int getHeight () const
void setSamples (int samples)
int getSamples () const
void setOrigin (fpreal x, fpreal y)
 Sets the origin for the lower-left corner. Normally 0,0.
void getOrigin (fpreal &x, fpreal &y) const
bool isValid (RE_Render *r, RE_FBOStatus *status=NULL)
bool isAttached (RE_Render *r, RE_Texture *tex)
 Returns true if the texture is attached to this framebuffer.
bool bind (RE_Render *r, bool for_draw=true)
 Binds the framebuffer as the active draw or read FBO.
void unbind (RE_Render *r)
bool begin (RE_Render *r, RE_BufferAttachment buf, int colorbufnum=0, bool initview=true)
bool begin (RE_Render *r)
void end (RE_Render *r)
bool beginRead (RE_Render *r, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0)
bool isActiveDraw ()
 Returns true if the framebuffer is being drawn to.
void interruptDraw (RE_Render *r)
void resumeDraw (RE_Render *r)
void drawToBuffer (RE_Render *r, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0)
void readFromBuffer (RE_Render *r, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0)
void drawToBuffers (RE_Render *r, int num, const int *bufferlist)
void drawToAllBuffers (RE_Render *r)
bool readAsyncFromBuffers (RE_Render *r, int num, int *bufferlist)
bool readFromRenderBuffer (RE_Render *r, void *buffer, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0)
bool blitFromFramebuffer (RE_Render *r, RE_OGLFramebuffer *from_fbo, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0)
bool detach (RE_Render *r, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0, bool freeme=false)
bool detachAndFree (RE_Render *r, RE_BufferAttachment buf=RE_COLOR_BUFFER, int colorbufnum=0)
bool writeToFile (RE_Render *r, const char *filename, RE_BufferAttachment buf, int colorbufnum=0)
 Mostly for debug, this writes out the given attachment to an image file.

Static Public Member Functions

static bool isFrameBufferSupported (RE_Render *r)
static int getNumColorAttachments ()
static const char * getFBOErrorMessage (RE_FBOStatus status)
 Returns the error string for the given status.
static int getMaxDrawBuffers (RE_Render *r)
 Returns the maximum number of color buffers that can be drawn to at once.
static RE_OGLFramebuffergetFBO (int id)
static void unregisterFBO (int id)
static bool verifyBinding (RE_Render *r, RE_OGLFramebuffer *fbo, RE_BufferBindMode bindmode=RE_BIND_DRAW)


Detailed Description

Definition at line 80 of file RE_OGLFramebuffer.h.


Member Enumeration Documentation

Enumerator:
RE_BIND_NONE 
RE_BIND_READ 
RE_BIND_DRAW 

Definition at line 241 of file RE_OGLFramebuffer.h.


Constructor & Destructor Documentation

RE_OGLFramebuffer::RE_OGLFramebuffer ( const char *  name = NULL  ) 

RE_OGLFramebuffer::~RE_OGLFramebuffer (  ) 


Member Function Documentation

bool RE_OGLFramebuffer::attachRenderbuffer ( RE_Render r,
RE_OGLRenderbuffer rbuf,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0 
)

bool RE_OGLFramebuffer::attachTexture ( RE_Render r,
RE_Texture t,
int  level = -1,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0 
)

Attach a texture to the framebuffer. You are still responsible for deleting it. 'Level' is the mip level for 2D textures, the cube face (RE_TextureCubeFace) for cube maps, and the Z-coord for 3D textures.

bool RE_OGLFramebuffer::begin ( RE_Render r  ) 

bool RE_OGLFramebuffer::begin ( RE_Render r,
RE_BufferAttachment  buf,
int  colorbufnum = 0,
bool  initview = true 
)

do all rendering between the begin/end statements. Renders to the given attachment. Specify initview = true set the modelview matrix to an orthographic projection the size of the framebuffer, the viewport to the size of the framebuffer, and to push the current GL state (via RE_OGLRender::pushState(1)).

bool RE_OGLFramebuffer::beginRead ( RE_Render r,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0 
)

bool RE_OGLFramebuffer::bind ( RE_Render r,
bool  for_draw = true 
)

Binds the framebuffer as the active draw or read FBO.

bool RE_OGLFramebuffer::blitFromFramebuffer ( RE_Render r,
RE_OGLFramebuffer from_fbo,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0 
)

Copies the framebuffer 'from_fbo' to this framebuffer. This is often used for resolving multisample framebuffers into an image.

RE_OGLRenderbuffer* RE_OGLFramebuffer::createRenderbuffer ( RE_Render r,
RE_GPUType  type,
int  vectorsize,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0,
int  samples = 0 
)

Create a renderbuffer and attach it to the framebuffer. This will be cleaned up when you delete the render buffer, or call clearAttachment() on it. If 'samples' > 1, this is a multisample (AA) Framebuffer, which must be blit'ed to a single-sample FBO before being read.

RE_Texture* RE_OGLFramebuffer::createTexture ( RE_Render r,
RE_GPUType  type,
int  vectorsize,
int  miplevel = -1,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0,
bool  rect = false,
int  samples = 0 
)

Create a 2D texture and attach it to the framebuffer. You are still responsible for deleting it. Specify rect = true to create a texture rectangle (check to see that this extension is supported before calling this method). Samples > 0 requires the texture-multisample extension, and these can only be accessed via shaders.

bool RE_OGLFramebuffer::detach ( RE_Render r,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0,
bool  freeme = false 
)

Removes the attachment, and frees the renderbuffer or texture if freeme is true.

bool RE_OGLFramebuffer::detachAndFree ( RE_Render r,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0 
) [inline]

Definition at line 236 of file RE_OGLFramebuffer.h.

void RE_OGLFramebuffer::drawToAllBuffers ( RE_Render r  ) 

Draws to all color buffers up to getMaxDrawBuffers(). The Z/Stencil buffers are written as well if depth or stencil writing is enabled.

void RE_OGLFramebuffer::drawToBuffer ( RE_Render r,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0 
)

void RE_OGLFramebuffer::drawToBuffers ( RE_Render r,
int  num,
const int *  bufferlist 
)

allows you to draw to multiple buffers at once. The type RE_COLOR_BUFFER is assumed. There is a limit on the number you can write to simultaneously, getMaxDrawBuffers().

void RE_OGLFramebuffer::end ( RE_Render r  ) 

RE_OGLRenderbuffer* RE_OGLFramebuffer::getBufferAttachment ( RE_BufferAttachment  buf,
int  colorbufnum = 0 
)

static RE_OGLFramebuffer* RE_OGLFramebuffer::getFBO ( int  id  )  [static]

static const char* RE_OGLFramebuffer::getFBOErrorMessage ( RE_FBOStatus  status  )  [static]

Returns the error string for the given status.

int RE_OGLFramebuffer::getHeight (  )  const [inline]

Definition at line 149 of file RE_OGLFramebuffer.h.

static int RE_OGLFramebuffer::getMaxDrawBuffers ( RE_Render r  )  [static]

Returns the maximum number of color buffers that can be drawn to at once.

const char* RE_OGLFramebuffer::getName ( void   )  [inline]

Definition at line 89 of file RE_OGLFramebuffer.h.

static int RE_OGLFramebuffer::getNumColorAttachments (  )  [static]

void RE_OGLFramebuffer::getOrigin ( fpreal x,
fpreal y 
) const

int RE_OGLFramebuffer::getSamples (  )  const [inline]

Definition at line 152 of file RE_OGLFramebuffer.h.

RE_Texture* RE_OGLFramebuffer::getTextureAttachment ( RE_BufferAttachment  buf,
int  colorbufnum = 0 
)

int RE_OGLFramebuffer::getWidth (  )  const [inline]

Definition at line 148 of file RE_OGLFramebuffer.h.

bool RE_OGLFramebuffer::hasAttachment ( RE_BufferAttachment  buf,
int  colorbufnum = 0 
)

void RE_OGLFramebuffer::interruptDraw ( RE_Render r  )  [inline]

Definition at line 190 of file RE_OGLFramebuffer.h.

bool RE_OGLFramebuffer::isActiveDraw (  )  [inline]

Returns true if the framebuffer is being drawn to.

Definition at line 188 of file RE_OGLFramebuffer.h.

bool RE_OGLFramebuffer::isAttached ( RE_Render r,
RE_Texture tex 
)

Returns true if the texture is attached to this framebuffer.

static bool RE_OGLFramebuffer::isFrameBufferSupported ( RE_Render r  )  [static]

bool RE_OGLFramebuffer::isTextureAttachment ( RE_BufferAttachment  buf,
int  colorbufnum = 0 
)

bool RE_OGLFramebuffer::isValid ( RE_Render r,
RE_FBOStatus status = NULL 
)

Returns true if the framebuffer is ready to render. Optionally returns a more detailed failure description if 'status' is provided.

bool RE_OGLFramebuffer::readAsyncFromBuffers ( RE_Render r,
int  num,
int *  bufferlist 
)

void RE_OGLFramebuffer::readFromBuffer ( RE_Render r,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0 
)

bool RE_OGLFramebuffer::readFromRenderBuffer ( RE_Render r,
void *  buffer,
RE_BufferAttachment  buf = RE_COLOR_BUFFER,
int  colorbufnum = 0 
)

reads the data from the render buffer specified into 'buffer'. 'buffer' must be large enough to contain the full renderbuffer size.

void RE_OGLFramebuffer::resumeDraw ( RE_Render r  )  [inline]

Definition at line 191 of file RE_OGLFramebuffer.h.

void RE_OGLFramebuffer::setOrigin ( fpreal  x,
fpreal  y 
)

Sets the origin for the lower-left corner. Normally 0,0.

void RE_OGLFramebuffer::setResolution ( int  width,
int  height 
)

You must call this if attaching textures (if you are creating textures, the resulotion of the textures you pass is used).

void RE_OGLFramebuffer::setSamples ( int  samples  ) 

void RE_OGLFramebuffer::unbind ( RE_Render r  ) 

static void RE_OGLFramebuffer::unregisterFBO ( int  id  )  [static]

static bool RE_OGLFramebuffer::verifyBinding ( RE_Render r,
RE_OGLFramebuffer fbo,
RE_BufferBindMode  bindmode = RE_BIND_DRAW 
) [static]

bool RE_OGLFramebuffer::verifyBufferAttachment ( RE_Render r,
RE_BufferAttachment  buf,
int  colorbufnum = 0,
RE_FBOStatus status = NULL 
)

Returns true if an attachment if framebuffer-complete.

bool RE_OGLFramebuffer::writeToFile ( RE_Render r,
const char *  filename,
RE_BufferAttachment  buf,
int  colorbufnum = 0 
)

Mostly for debug, this writes out the given attachment to an image file.


The documentation for this class was generated from the following file:

Generated on Mon Jan 28 00:29:51 2013 for HDK by  doxygen 1.5.9