# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Member Functions | Friends

# vl::RenderTarget Class Reference

The RenderTarget class defines an abstract 'surface' where OpenGL can render into. More...

`#include <RenderTarget.hpp>`

Inheritance diagram for vl::RenderTarget:

List of all members.

## Public Member Functions

OpenGLContext * | openglContext ()
| The OpenGLContext bound to a render target.
const OpenGLContext * | openglContext () const
| The OpenGLContext bound to a render target.
int | width () const
| The width of a render target.
int | height () const
| The height of a render target.
void | setWidth (int width)
| The width of a render target.
void | setHeight (int height)
| The height of a render target.
virtual GLuint | handle () const
| The framebuffer object id as used by glBindFramebuffer, RenderTarget::handle() always returns 0, i.e., the standard OpenGL framebuffer.
void | activate (EFrameBufferBind target=FBB_FRAMEBUFFER)
| Activates the RenderTarget by calling bindFramebuffer() and bindDrawBuffers()
virtual void | bindFramebuffer (EFrameBufferBind target=FBB_FRAMEBUFFER)
| Calls glBindFramebuffer(target, 0) thus activating the the framebuffer 0, that is, the normal OpenGL buffers.
void | bindReadBuffer ()
| Binds to the currently active framebuffer object (including the 0 one) the read buffer specified by setReadBuffer().
void | bindDrawBuffers () const
| Binds to the currently active framebuffer object (including the 0 one) the draw buffers specified by setDrawBuffers().
bool | checkDrawBuffers () const
| Returns `true` if the draw buffers bound to this render target are legal for this render target type.
void | setDrawBuffer (EReadDrawBuffer draw_buffer)
| Specifies the color buffer to be drawn into.
void | setDrawBuffers (EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2)
| Specifies a list of color buffers to be drawn into.
void | setDrawBuffers (EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3)
| Specifies a list of color buffers to be drawn into.
void | setDrawBuffers (EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3, EReadDrawBuffer draw_buffer4)
| Specifies a list of color buffers to be drawn into.
void | setDrawBuffers (const std::vector< EReadDrawBuffer > &draw_buffers)
| Specifies a list of color buffers to be drawn into.
const std::vector < EReadDrawBuffer > & | drawBuffers ()
| The color buffers to be drawn into.
EReadDrawBuffer | readBuffer () const
| The read-buffer bound when the render target is activated.
void | setReadBuffer (EReadDrawBuffer read_buffer)
| The read-buffer bound when the render target is activated.

## Protected Member Functions

virtual const char * | className ()
| Returns the name of the class.
| RenderTarget (OpenGLContext *ctx, int w, int h)
| Constructor.

## Friends

class | OpenGLContext

## Detailed Description

The RenderTarget class defines an abstract 'surface' where OpenGL can render into.

See also:
  OpenGLContext::renderTarget() and FBORenderTarget

Definition at line 49 of file RenderTarget.hpp.

## Constructor & Destructor Documentation

vl::RenderTarget::RenderTarget | ( | OpenGLContext * | ctx,
|  | int | w,
|  | int | h
| ) |  | `[inline, protected]`

Constructor.

Definition at line 57 of file RenderTarget.hpp.

References vl::RDB_BACK_LEFT, and VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

virtual const char* vl::RenderTarget::className | ( | ) | `[inline, protected, virtual]`

Returns the name of the class.

Reimplemented from vl::Object.

Reimplemented in vl::FBORenderTarget.

Definition at line 54 of file RenderTarget.hpp.

OpenGLContext* vl::RenderTarget::openglContext | ( | ) | `[inline]`

The OpenGLContext bound to a render target.

Definition at line 66 of file RenderTarget.hpp.

Referenced by vl::FBORenderTarget::bindFramebuffer(), vl::FBORenderTarget::checkFramebufferStatus(), vl::FBORenderTarget::create(), vl::FBORenderTarget::destroy(), vl::FBORenderTarget::removeAttachment(), vl::Renderer::render(), vl::EdgeRenderer::render(), and vl::OcclusionCullRenderer::render_pass2().

const OpenGLContext* vl::RenderTarget::openglContext | ( | ) | const`[inline]`

The OpenGLContext bound to a render target.

Definition at line 69 of file RenderTarget.hpp.

int vl::RenderTarget::width | ( | ) | const`[inline]`

The width of a render target.

Definition at line 72 of file RenderTarget.hpp.

Referenced by vl::FBORenderbufferAttachment::bindAttachment(), vl::FBOTextureLayerAttachment::bindAttachment(), vl::FBOTexture3DAttachment::bindAttachment(), vl::FBOTexture2DAttachment::bindAttachment(), vl::FBOTexture1DAttachment::bindAttachment(), vl::FBORenderTarget::bindFramebuffer(), vl::FBORenderTarget::checkFramebufferStatus(), and vl::Applet::resizeEvent().

int vl::RenderTarget::height | ( | ) | const`[inline]`

The height of a render target.

Definition at line 75 of file RenderTarget.hpp.

Referenced by vl::FBORenderbufferAttachment::bindAttachment(), vl::FBOTextureLayerAttachment::bindAttachment(), vl::FBOTexture3DAttachment::bindAttachment(), vl::FBOTexture2DAttachment::bindAttachment(), vl::FBORenderTarget::bindFramebuffer(), vl::FBORenderTarget::checkFramebufferStatus(), vl::GhostCameraManipulator::enableEvent(), vl::TrackballManipulator::mouseDownEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::GhostCameraManipulator::mouseMoveEvent(), and vl::Applet::resizeEvent().

void vl::RenderTarget::setWidth | ( | int | width ) | `[inline]`

The width of a render target.

Definition at line 78 of file RenderTarget.hpp.

Referenced by vl::FBORenderTarget::destroy(), and vlWin32::Win32Window::WindowProc().

void vl::RenderTarget::setHeight | ( | int | height ) | `[inline]`

The height of a render target.

Definition at line 81 of file RenderTarget.hpp.

Referenced by vl::FBORenderTarget::destroy(), and vlWin32::Win32Window::WindowProc().

virtual GLuint vl::RenderTarget::handle | ( | ) | const`[inline, virtual]`

The framebuffer object id as used by glBindFramebuffer, RenderTarget::handle() always returns 0, i.e., the standard OpenGL framebuffer.

Reimplemented in vl::FBORenderTarget.

Definition at line 84 of file RenderTarget.hpp.

void vl::RenderTarget::activate | ( | EFrameBufferBind | target = `FBB_FRAMEBUFFER` ) | `[inline]`

Activates the RenderTarget by calling bindFramebuffer() and bindDrawBuffers()

Definition at line 87 of file RenderTarget.hpp.

Referenced by vl::BlitFramebuffer::copyPixels().

virtual void vl::RenderTarget::bindFramebuffer | ( | EFrameBufferBind | target = `FBB_FRAMEBUFFER` ) | `[inline, virtual]`

Calls glBindFramebuffer(target, 0) thus activating the the framebuffer 0, that is, the normal OpenGL buffers.

Note:
  This method is overridden in FBORenderTarget in order to activate the appropriate framebuffer object.

Reimplemented in vl::FBORenderTarget.

Definition at line 96 of file RenderTarget.hpp.

References VL_CHECK_OGL, and vl::VL_glBindFramebuffer().

void RenderTarget::bindReadBuffer | ( | ) |

Binds to the currently active framebuffer object (including the 0 one) the read buffer specified by setReadBuffer().

Definition at line 159 of file RenderTarget.cpp.

References readBuffer(), and VL_CHECK_OGL.

Referenced by vl::FBORenderTarget::bindFramebuffer().

void RenderTarget::bindDrawBuffers | ( | ) | const

Binds to the currently active framebuffer object (including the 0 one) the draw buffers specified by setDrawBuffers().

Definition at line 131 of file RenderTarget.cpp.

References checkDrawBuffers(), vl::Log::error(), VL_CHECK, and VL_CHECK_OGL.

Referenced by vl::FBORenderTarget::bindFramebuffer().

bool RenderTarget::checkDrawBuffers | ( | ) | const

Returns `true` if the draw buffers bound to this render target are legal for this render target type.

Definition at line 44 of file RenderTarget.cpp.

References vl::Log::error().

Referenced by bindDrawBuffers().

void vl::RenderTarget::setDrawBuffer | ( | EReadDrawBuffer | draw_buffer ) | `[inline]`

Specifies the color buffer to be drawn into.

Definition at line 122 of file RenderTarget.hpp.

void vl::RenderTarget::setDrawBuffers | ( | EReadDrawBuffer | draw_buffer1,
|  | EReadDrawBuffer | draw_buffer2
| ) |  | `[inline]`

Specifies a list of color buffers to be drawn into.

Definition at line 129 of file RenderTarget.hpp.

void vl::RenderTarget::setDrawBuffers | ( | EReadDrawBuffer | draw_buffer1,
|  | EReadDrawBuffer | draw_buffer2,
|  | EReadDrawBuffer | draw_buffer3
| ) |  | `[inline]`

Specifies a list of color buffers to be drawn into.

Definition at line 137 of file RenderTarget.hpp.

void vl::RenderTarget::setDrawBuffers | ( | EReadDrawBuffer | draw_buffer1,
|  | EReadDrawBuffer | draw_buffer2,
|  | EReadDrawBuffer | draw_buffer3,
|  | EReadDrawBuffer | draw_buffer4
| ) |  | `[inline]`

Specifies a list of color buffers to be drawn into.

Definition at line 146 of file RenderTarget.hpp.

void vl::RenderTarget::setDrawBuffers | ( | const std::vector< EReadDrawBuffer > & | draw_buffers ) | `[inline]`

Specifies a list of color buffers to be drawn into.

Definition at line 156 of file RenderTarget.hpp.

const std::vector< EReadDrawBuffer >& vl::RenderTarget::drawBuffers | ( | ) | `[inline]`

The color buffers to be drawn into.

Definition at line 159 of file RenderTarget.hpp.

EReadDrawBuffer vl::RenderTarget::readBuffer | ( | ) | const`[inline]`

The read-buffer bound when the render target is activated.

Definition at line 162 of file RenderTarget.hpp.

Referenced by bindReadBuffer().

void vl::RenderTarget::setReadBuffer | ( | EReadDrawBuffer | read_buffer ) | `[inline]`

The read-buffer bound when the render target is activated.

Definition at line 165 of file RenderTarget.hpp.

## Friends And Related Function Documentation

friend class OpenGLContext`[friend]`

Reimplemented in vl::FBORenderTarget.

Definition at line 51 of file RenderTarget.hpp.

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/RenderTarget.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/RenderTarget.cpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:45.
Permission is granted to use this page to write and publish articles regarding Visualization Library.