Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
cinder::dx::RenderTarget Class Reference

Represents an DirectX RenderTarget object. More...

#include <DxRenderTarget.h>

Classes

struct  Format
 
struct  Obj
 

Public Member Functions

 RenderTarget ()
 Creates a NULL FBO. More...
 
 RenderTarget (int width, int height, Format format=Format())
 Creates an FBO width pixels wide and height pixels high, using Fbo::Format format. More...
 
 RenderTarget (int width, int height, bool alpha, bool color=true, bool depth=true)
 Creates an FBO width pixels wide and height pixels high, with an optional alpha channel, color buffer and depth buffer. More...
 
int getWidth () const
 Returns the width of the FBO in pixels. More...
 
int getHeight () const
 Returns the height of the FBO in pixels. More...
 
Vec2i getSize () const
 Returns the size of the FBO in pixels. More...
 
Area getBounds () const
 Returns the bounding area of the FBO in pixels. More...
 
float getAspectRatio () const
 Returns the aspect ratio of the FBO. More...
 
const FormatgetFormat () const
 Returns the Fbo::Format of this FBO. More...
 
dx::TextureRef getTexture (int attachment=0)
 Returns the texture target for this FBO. Typically GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB. More...
 
dx::TextureRef getDepthTexture ()
 Returns a reference to the depth texture of the FBO. More...
 
void bindTexture (int textureUnit=0, int attachment=0)
 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. More...
 
void unbindTexture ()
 Unbinds the texture associated with an Fbo's target. More...
 
void bindDepthTexture (int textureUnit=0)
 Binds the depth texture associated with an Fbo to its target. More...
 
void bindFramebuffer ()
 Binds the Fbo as the currently active framebuffer, meaning it will receive the results of all subsequent rendering until it is unbound. More...
 
void blitTo (RenderTarget dst, const Area &srcArea, const Area &dstArea, GLenum filter=GL_NEAREST, GLbitfield mask=GL_COLOR_BUFFER_BIT) const
 Returns the ID of the framebuffer itself. For antialiased FBOs this is the ID of the output multisampled FBO. More...
 
void blitToScreen (const Area &srcArea, const Area &dstArea, GLenum filter=GL_NEAREST, GLbitfield mask=GL_COLOR_BUFFER_BIT) const
 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. More...
 
void blitFromScreen (const Area &srcArea, const Area &dstArea, GLenum filter=GL_NEAREST, GLbitfield mask=GL_COLOR_BUFFER_BIT)
 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. More...
 

Static Public Member Functions

static RenderTargetRef create (int width, int height, Format format=Format())
 Creates an FBO width pixels wide and height pixels high, using Fbo::Format format. More...
 
static RenderTargetRef create (int width, int height, bool alpha, bool color=true, bool depth=true)
 Creates an FBO width pixels wide and height pixels high, with an optional alpha channel, color buffer and depth buffer. More...
 
static void unbindFramebuffer ()
 Unbinds the Fbo as the currently active framebuffer, restoring the primary context as the target for all subsequent rendering. More...
 
static int getMaxAttachments ()
 Returns the maximum number of color attachments the graphics card is capable of using for an Fbo. More...
 

Protected Member Functions

void init ()
 
bool initMultisample (bool csaa)
 
void resolveTextures () const
 
void updateMipmaps (bool bindFirst, int attachment) const
 
bool checkStatus (class RenderTargetExceptionInvalidSpecification *resultExc)
 

Protected Attributes

std::shared_ptr< ObjmObj
 

Static Protected Attributes

static GLint sMaxSamples
 
static GLint sMaxAttachments = -1
 
typedef std::shared_ptr< Obj >
RenderTarget::* 
unspecified_bool_type
 Emulates shared_ptr-like behavior. More...
 
 operator unspecified_bool_type () const
 Emulates shared_ptr-like behavior. More...
 
void reset ()
 Emulates shared_ptr-like behavior. More...
 

Detailed Description

Represents an DirectX RenderTarget object.

Member Typedef Documentation

typedef std::shared_ptr<Obj> RenderTarget::* cinder::dx::RenderTarget::unspecified_bool_type

Emulates shared_ptr-like behavior.

Constructor & Destructor Documentation

cinder::dx::RenderTarget::RenderTarget ( )

Creates a NULL FBO.

cinder::dx::RenderTarget::RenderTarget ( int  width,
int  height,
Format  format = Format() 
)

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

cinder::dx::RenderTarget::RenderTarget ( int  width,
int  height,
bool  alpha,
bool  color = true,
bool  depth = true 
)

Creates an FBO width pixels wide and height pixels high, with an optional alpha channel, color buffer and depth buffer.

Member Function Documentation

RenderTargetRef cinder::dx::RenderTarget::create ( int  width,
int  height,
Format  format = Format() 
)
static

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

RenderTargetRef cinder::dx::RenderTarget::create ( int  width,
int  height,
bool  alpha,
bool  color = true,
bool  depth = true 
)
static

Creates an FBO width pixels wide and height pixels high, with an optional alpha channel, color buffer and depth buffer.

int cinder::dx::RenderTarget::getWidth ( ) const

Returns the width of the FBO in pixels.

int cinder::dx::RenderTarget::getHeight ( ) const

Returns the height of the FBO in pixels.

Vec2i cinder::dx::RenderTarget::getSize ( ) const

Returns the size of the FBO in pixels.

Area cinder::dx::RenderTarget::getBounds ( ) const

Returns the bounding area of the FBO in pixels.

float cinder::dx::RenderTarget::getAspectRatio ( ) const

Returns the aspect ratio of the FBO.

const Format& cinder::dx::RenderTarget::getFormat ( ) const

Returns the Fbo::Format of this FBO.

dx::TextureRef cinder::dx::RenderTarget::getTexture ( int  attachment = 0)

Returns the texture target for this FBO. Typically GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB.

Returns a reference to the color texture of the FBO. attachment specifies which attachment in the case of multiple color buffers

dx::TextureRef cinder::dx::RenderTarget::getDepthTexture ( )

Returns a reference to the depth texture of the FBO.

void cinder::dx::RenderTarget::bindTexture ( int  textureUnit = 0,
int  attachment = 0 
)

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::dx::RenderTarget::unbindTexture ( )

Unbinds the texture associated with an Fbo's target.

void cinder::dx::RenderTarget::bindDepthTexture ( int  textureUnit = 0)

Binds the depth texture associated with an Fbo to its target.

void cinder::dx::RenderTarget::bindFramebuffer ( )

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

void cinder::dx::RenderTarget::unbindFramebuffer ( )
static

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

void cinder::dx::RenderTarget::blitTo ( RenderTarget  dst,
const Area srcArea,
const Area dstArea,
GLenum  filter = GL_NEAREST,
GLbitfield  mask = GL_COLOR_BUFFER_BIT 
) const

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

For antialiased FBOs this returns the ID of the mirror FBO designed for reading, where the multisampled render buffers are resolved to. For non-antialised, this is the equivalent to getId() 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::dx::RenderTarget::blitToScreen ( const Area srcArea,
const Area dstArea,
GLenum  filter = GL_NEAREST,
GLbitfield  mask = GL_COLOR_BUFFER_BIT 
) const

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::dx::RenderTarget::blitFromScreen ( const Area srcArea,
const Area dstArea,
GLenum  filter = GL_NEAREST,
GLbitfield  mask = GL_COLOR_BUFFER_BIT 
)

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::dx::RenderTarget::getMaxAttachments ( )
static

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

void cinder::dx::RenderTarget::init ( )
protected
bool cinder::dx::RenderTarget::initMultisample ( bool  csaa)
protected
void cinder::dx::RenderTarget::resolveTextures ( ) const
protected
void cinder::dx::RenderTarget::updateMipmaps ( bool  bindFirst,
int  attachment 
) const
protected
bool cinder::dx::RenderTarget::checkStatus ( class RenderTargetExceptionInvalidSpecification resultExc)
protected
cinder::dx::RenderTarget::operator unspecified_bool_type ( ) const

Emulates shared_ptr-like behavior.

void cinder::dx::RenderTarget::reset ( )

Emulates shared_ptr-like behavior.

Member Data Documentation

std::shared_ptr<Obj> cinder::dx::RenderTarget::mObj
protected
GLint cinder::dx::RenderTarget::sMaxSamples
staticprotected
GLint cinder::dx::RenderTarget::sMaxAttachments = -1
staticprotected

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