Cinder  0.9.1
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
cinder::gl::FboCubeMap Class Reference

#include <Fbo.h>

Inherits cinder::gl::Fbo.

Classes

struct  Format
 

Public Member Functions

void bindFramebufferFace (GLenum faceTarget, GLint level=0, GLenum target=GL_FRAMEBUFFER, GLenum attachment=GL_COLOR_ATTACHMENT0)
 
mat4 calcViewMatrix (GLenum face, const vec3 &eyePos)
 
TextureCubeMapRef getTextureCubeMap (GLenum attachment=GL_COLOR_ATTACHMENT0)
 
int getWidth () const
 
int getHeight () const
 
ivec2 getSize () const
 
Area getBounds () const
 
float getAspectRatio () const
 
const FormatgetFormat () const
 
Format getFormat ()
 
Texture2dRef getColorTexture ()
 
Texture2dRef getDepthTexture ()
 
Texture2dRef getTexture2d (GLenum attachment)
 
TextureBaseRef getTextureBase (GLenum attachment)
 
void bindTexture (int textureUnit=0, GLenum attachment=GL_COLOR_ATTACHMENT0)
 
void unbindTexture (int textureUnit=0, GLenum attachment=GL_COLOR_ATTACHMENT0)
 
void bindFramebuffer (GLenum target=GL_FRAMEBUFFER)
 
void resolveTextures () const
 
GLuint getId () const
 
GLuint getMultisampleId () const
 
GLuint getResolveId () const
 
void markAsDirty ()
 
void blitTo (const FboRef &dst, const Area &srcArea, const Area &dstArea, GLenum filter=GL_NEAREST, GLbitfield mask=GL_COLOR_BUFFER_BIT) const
 
void blitToScreen (const Area &srcArea, const Area &dstArea, GLenum filter=GL_NEAREST, GLbitfield mask=GL_COLOR_BUFFER_BIT) const
 
void blitFromScreen (const Area &srcArea, const Area &dstArea, GLenum filter=GL_NEAREST, GLbitfield mask=GL_COLOR_BUFFER_BIT)
 
const std::string & getLabel () const
 
void setLabel (const std::string &label)
 
Surface8u readPixels8u (const Area &area, GLenum attachment=GL_COLOR_ATTACHMENT0) const
 

Static Public Member Functions

static FboCubeMapRef create (int32_t faceWidth, int32_t faceHeight, const Format &format=Format())
 
static FboRef create (int width, int height, const Format &format=Format())
 
static FboRef create (int width, int height, bool alpha, bool depth=true, bool stencil=false)
 
static void unbindFramebuffer ()
 
static GLint getMaxSamples ()
 
static GLint getMaxAttachments ()
 

Protected Member Functions

 FboCubeMap (int32_t faceWidth, int32_t faceHeight, const Format &format, const TextureCubeMapRef &textureCubeMap)
 
void init ()
 
void initMultisamplingSettings (bool *useMsaa, bool *useCsaa, Format *format)
 
void prepareAttachments (const Format &format, bool multisampling)
 
void attachAttachments ()
 
void initMultisample (const Format &format)
 
void updateMipmaps (GLenum attachment) const
 
bool checkStatus (class FboExceptionInvalidSpecification *resultExc)
 
void setDrawBuffers (GLuint fbId, const std::map< GLenum, RenderbufferRef > &attachmentsBuffer, const std::map< GLenum, TextureBaseRef > &attachmentsTexture)
 

Protected Attributes

TextureCubeMapRef mTextureCubeMap
 
int mWidth
 
int mHeight
 
Format mFormat
 
GLuint mId
 
GLuint mMultisampleFramebufferId
 
std::map< GLenum, RenderbufferRefmAttachmentsBuffer
 
std::map< GLenum, RenderbufferRefmAttachmentsMultisampleBuffer
 
std::map< GLenum, TextureBaseRefmAttachmentsTexture
 
std::string mLabel
 
bool mNeedsResolve
 
bool mNeedsMipmapUpdate
 

Static Protected Attributes

static GLint sMaxSamples = -1
 
static GLint sMaxAttachments = -1
 

Detailed Description

Helper class for implementing dynamic cube mapping.

Constructor & Destructor Documentation

cinder::gl::FboCubeMap::FboCubeMap ( int32_t  faceWidth,
int32_t  faceHeight,
const Format format,
const TextureCubeMapRef textureCubeMap 
)
protected

Member Function Documentation

FboCubeMapRef cinder::gl::FboCubeMap::create ( int32_t  faceWidth,
int32_t  faceHeight,
const Format format = Format() 
)
static
void cinder::gl::FboCubeMap::bindFramebufferFace ( GLenum  faceTarget,
GLint  level = 0,
GLenum  target = GL_FRAMEBUFFER,
GLenum  attachment = GL_COLOR_ATTACHMENT0 
)

Binds a face of the Fbo as the currently active framebuffer. faceTarget expects values in the GL_TEXTURE_CUBE_MAP_POSITIVE_X family.

mat4 cinder::gl::FboCubeMap::calcViewMatrix ( GLenum  face,
const vec3 &  eyePos 
)

Returns the view matrix appropriate for a given face (in the GL_TEXTURE_CUBE_MAP_POSITIVE_X family) looking from the position eyePos.

TextureCubeMapRef cinder::gl::FboCubeMap::getTextureCubeMap ( GLenum  attachment = GL_COLOR_ATTACHMENT0)

Returns a TextureCubeMapRef attached at attachment (default GL_COLOR_ATTACHMENT0). Resolves multisampling and renders mipmaps if necessary. Returns NULL if a TextureCubeMap is not bound at attachment.

FboRef cinder::gl::Fbo::create ( int  width,
int  height,
const Format format = Format() 
)
staticinherited

Creates an FBO width pixels wide and height pixels high, using Fbo::Format format.

FboRef cinder::gl::Fbo::create ( int  width,
int  height,
bool  alpha,
bool  depth = true,
bool  stencil = false 
)
staticinherited

Creates an FBO width pixels wide and height pixels high, a color texture (with optional alpha channel), and optionally a depth buffer and stencil buffer.

int cinder::gl::Fbo::getWidth ( ) const
inherited

Returns the width of the FBO in pixels.

int cinder::gl::Fbo::getHeight ( ) const
inherited

Returns the height of the FBO in pixels.

ivec2 cinder::gl::Fbo::getSize ( ) const
inherited

Returns the size of the FBO in pixels.

Area cinder::gl::Fbo::getBounds ( ) const
inherited

Returns the bounding area of the FBO in pixels.

float cinder::gl::Fbo::getAspectRatio ( ) const
inherited

Returns the aspect ratio of the FBO.

const Format& cinder::gl::Fbo::getFormat ( ) const
inherited

Returns the Fbo::Format of this FBO.

Format cinder::gl::Fbo::getFormat ( )
inherited

Returns the Fbo::Format of this FBO.

Texture2dRef cinder::gl::Fbo::getColorTexture ( )
inherited

Returns a reference to the color Texture2d of the FBO (at GL_COLOR_ATTACHMENT0). Resolves multisampling and renders mipmaps if necessary. Returns an empty Ref if there is no Texture2d attached at GL_COLOR_ATTACHMENT0.

Texture2dRef cinder::gl::Fbo::getDepthTexture ( )
inherited

Returns a reference to the depth Texture2d of the FBO. Resolves multisampling and renders mipmaps if necessary. Returns an empty Ref if there is no Texture2d as a depth attachment.

Texture2dRef cinder::gl::Fbo::getTexture2d ( GLenum  attachment)
inherited

Returns a Texture2dRef attached at attachment (such as GL_COLOR_ATTACHMENT0). Resolves multisampling and renders mipmaps if necessary. Returns NULL if a Texture2d is not bound at attachment.

TextureBaseRef cinder::gl::Fbo::getTextureBase ( GLenum  attachment)
inherited

Returns a TextureBaseRef attached at attachment (such as GL_COLOR_ATTACHMENT0). Resolves multisampling and renders mipmaps if necessary. Returns NULL if a Texture is not bound at attachment.

void cinder::gl::Fbo::bindTexture ( int  textureUnit = 0,
GLenum  attachment = GL_COLOR_ATTACHMENT0 
)
inherited

Binds the color texture associated with an Fbo to its target. Optionally binds to a multitexturing unit when textureUnit is non-zero. Optionally binds to a multitexturing unit when textureUnit is non-zero. attachment specifies which color buffer in the case of multiple attachments.

void cinder::gl::Fbo::unbindTexture ( int  textureUnit = 0,
GLenum  attachment = GL_COLOR_ATTACHMENT0 
)
inherited

Unbinds the texture associated with an Fbo attachment.

void cinder::gl::Fbo::bindFramebuffer ( GLenum  target = GL_FRAMEBUFFER)
inherited

Binds the Fbo as the currently active framebuffer, meaning it will receive the results of all subsequent rendering until it is unbound.

void cinder::gl::Fbo::unbindFramebuffer ( )
staticinherited

Unbinds the Fbo as the currently active framebuffer, restoring the primary context as the target for all subsequent rendering.

void cinder::gl::Fbo::resolveTextures ( ) const
inherited

Resolves internal Multisample FBO to attached Textures. Only necessary when not using getColorTexture() or getTexture(), which resolve automatically.

GLuint cinder::gl::Fbo::getId ( ) const
inherited

Returns the ID of the framebuffer. For antialiased FBOs this is the ID of the output multisampled FBO.

GLuint cinder::gl::Fbo::getMultisampleId ( ) const
inherited

For antialiased FBOs this returns the ID of the mirror FBO designed for multisampled writing. Returns 0 otherwise.

GLuint cinder::gl::Fbo::getResolveId ( ) const
inherited

Returns the resolve FBO, which is the same value as getId() without multisampling.

void cinder::gl::Fbo::markAsDirty ( )
inherited

Marks multisampling framebuffer and mipmaps as needing updates. Not generally necessary to call directly.

void cinder::gl::Fbo::blitTo ( const FboRef dst,
const Area srcArea,
const Area dstArea,
GLenum  filter = GL_NEAREST,
GLbitfield  mask = GL_COLOR_BUFFER_BIT 
) const
inherited

Copies to FBO dst from srcArea to dstArea using filter filter. mask allows specification of color (GL_COLOR_BUFFER_BIT) and/or depth(GL_DEPTH_BUFFER_BIT). Calls glBlitFramebufferEXT() and is subject to its constraints and coordinate system.

void cinder::gl::Fbo::blitToScreen ( const Area srcArea,
const Area dstArea,
GLenum  filter = GL_NEAREST,
GLbitfield  mask = GL_COLOR_BUFFER_BIT 
) const
inherited

Copies to the screen from Area srcArea to dstArea using filter filter. mask allows specification of color (GL_COLOR_BUFFER_BIT) and/or depth(GL_DEPTH_BUFFER_BIT). Calls glBlitFramebufferEXT() and is subject to its constraints and coordinate system.

void cinder::gl::Fbo::blitFromScreen ( const Area srcArea,
const Area dstArea,
GLenum  filter = GL_NEAREST,
GLbitfield  mask = GL_COLOR_BUFFER_BIT 
)
inherited

Copies from the screen from Area srcArea to dstArea using filter filter. mask allows specification of color (GL_COLOR_BUFFER_BIT) and/or depth(GL_DEPTH_BUFFER_BIT). Calls glBlitFramebufferEXT() and is subject to its constraints and coordinate system.

GLint cinder::gl::Fbo::getMaxSamples ( )
staticinherited

Returns the maximum number of samples the graphics card is capable of using per pixel in MSAA for an Fbo.

GLint cinder::gl::Fbo::getMaxAttachments ( )
staticinherited

Returns the maximum number of color attachments the graphics card is capable of using for an Fbo.

const std::string& cinder::gl::Fbo::getLabel ( ) const
inherited

Returns the debugging label associated with the Fbo.

void cinder::gl::Fbo::setLabel ( const std::string &  label)
inherited

Sets the debugging label associated with the Fbo. Calls glObjectLabel() when available.

Surface8u cinder::gl::Fbo::readPixels8u ( const Area area,
GLenum  attachment = GL_COLOR_ATTACHMENT0 
) const
inherited

Returns a copy of the pixels in attachment within area (cropped to the bounding rectangle of the attachment) as an 8-bit per channel Surface. attachment ignored on ES 2.

void cinder::gl::Fbo::init ( )
protectedinherited
void cinder::gl::Fbo::initMultisamplingSettings ( bool *  useMsaa,
bool *  useCsaa,
Format format 
)
protectedinherited
void cinder::gl::Fbo::prepareAttachments ( const Format format,
bool  multisampling 
)
protectedinherited
void cinder::gl::Fbo::attachAttachments ( )
protectedinherited
void cinder::gl::Fbo::initMultisample ( const Format format)
protectedinherited
void cinder::gl::Fbo::updateMipmaps ( GLenum  attachment) const
protectedinherited
bool cinder::gl::Fbo::checkStatus ( class FboExceptionInvalidSpecification resultExc)
protectedinherited
void cinder::gl::Fbo::setDrawBuffers ( GLuint  fbId,
const std::map< GLenum, RenderbufferRef > &  attachmentsBuffer,
const std::map< GLenum, TextureBaseRef > &  attachmentsTexture 
)
protectedinherited

Member Data Documentation

TextureCubeMapRef cinder::gl::FboCubeMap::mTextureCubeMap
protected
int cinder::gl::Fbo::mWidth
protectedinherited
int cinder::gl::Fbo::mHeight
protectedinherited
Format cinder::gl::Fbo::mFormat
protectedinherited
GLuint cinder::gl::Fbo::mId
protectedinherited
GLuint cinder::gl::Fbo::mMultisampleFramebufferId
protectedinherited
std::map<GLenum,RenderbufferRef> cinder::gl::Fbo::mAttachmentsBuffer
protectedinherited
std::map<GLenum,RenderbufferRef> cinder::gl::Fbo::mAttachmentsMultisampleBuffer
protectedinherited
std::map<GLenum,TextureBaseRef> cinder::gl::Fbo::mAttachmentsTexture
protectedinherited
std::string cinder::gl::Fbo::mLabel
protectedinherited
bool cinder::gl::Fbo::mNeedsResolve
mutableprotectedinherited
bool cinder::gl::Fbo::mNeedsMipmapUpdate
mutableprotectedinherited
GLint cinder::gl::Fbo::sMaxSamples = -1
staticprotectedinherited
GLint cinder::gl::Fbo::sMaxAttachments = -1
staticprotectedinherited

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