INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

hydroglu::GLFrameBuffer Class Reference

Class that wraps an OpenGL framebuffer object in a simplistic manner. More...

#include <glframebuffer.h>

List of all members.

Public Member Functions

 GLFrameBuffer (std::string name)
 GLFramebuffer constructor.
void attachTexture (GLTexturePtr texture, GLenum attachment)
 attach a GLTexture to one of the OpenGL attachment points
GLTexturePtr getTexture (GLenum attachment) const
 obtain the texture attached to a point or an empty GLTexturePtr
void bind () const
 bind this framebuffer for usage. Binding a framebuffer redirects the output of drawing using opengl to be this framebuffer same as glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, thisfbhandle );
void unbind () const
 unbind this framebuffer Unbinding a framebuffer means the render target is on screen again same as glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );

Detailed Description

Class that wraps an OpenGL framebuffer object in a simplistic manner.

A framebuffer is a way of attaching what is normally a read only buffer such as a texture to something that can be written to (drawn on in the case of textures).

Commonly used as the destination for GPGPU computations.

Multiple textures can be attached as output destionations for a framebuffer such that when the framebuffer is drawn to all of the attached textures are available in a glsl shader. This way, multiple computations that need to be stored seperately can be done in a single shader in a single pass.

Reading from a GLFrameBuffer back to memory can be done through the GLTexture download method.

Typical usage

 #include <hydroglu/hydroglu.h>
 //... other code
 //
 void initializeGL()
 {
    //setup opengl state
    //...
    //end setup opengl state
    
    fftTexture_ = new GLTexture("FFT Output Buffer", 640, 480);
    frameBufferPtr_ = new GLFrameBuffer("FFT Output");
    frameBufferPtr_->attachTexture(fftTexture_, GL_COLOR_ATTACHMENT0_EXT);
 }

 void paintGL()
 {
    fftprogram_->enable();
    frameBufferPtr_->bind();
    //clear the framebuffer
    glClear(GL_COLOR_BUFFER_BIT);
    //bind input texture
    fftinput_->bind();

    glBegin(GL_QUADS);

    //draw quad
    glEnd();

    fftinput_->unbind();
    frameBufferPtr_->unbind();
    fftprogram_->disable();

 }

Constructor & Destructor Documentation

GLFrameBuffer::GLFrameBuffer ( std::string  name  ) 

GLFramebuffer constructor.

Parameters:
name,used for debug output to easily identify which framebuffer the error comes from

Member Function Documentation

void GLFrameBuffer::attachTexture ( GLTexturePtr  texture,
GLenum  attachment 
)

attach a GLTexture to one of the OpenGL attachment points

Parameters:
hydroglu GLTexturePtr
enumerated attachment point, ex: GL_COLOR_ATTACHMENT0_EXT
GLTexturePtr GLFrameBuffer::getTexture ( GLenum  attachment  )  const

obtain the texture attached to a point or an empty GLTexturePtr

Parameters:
enumerated attachment point, ex: GL_COLOR_ATTACHMENT0_EXT
Returns:
a hydroglu GLTexturePtr that either points to the texture attached at the given attachment or is empty if there is none

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

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5