Visualization Library 2.0.0

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

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Friends | List of all members
vl::Framebuffer Class Reference

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

#include <Framebuffer.hpp>

+ Inheritance diagram for vl::Framebuffer:

Public Member Functions

 Framebuffer (OpenGLContext *ctx, int w, int h, EReadDrawBuffer draw_buffer, EReadDrawBuffer read_buffer)
 Constructor, see also OpenGLContext::framebuffer(). More...
 
OpenGLContextopenglContext ()
 The OpenGLContext bound to a render target. More...
 
const OpenGLContextopenglContext () const
 The OpenGLContext bound to a render target. More...
 
int width () const
 The width of a render target. More...
 
int height () const
 The height of a render target. More...
 
void setWidth (int width)
 The width of a render target. More...
 
void setHeight (int height)
 The height of a render target. More...
 
virtual GLuint handle () const
 The framebuffer object id as used by glBindFramebuffer, Framebuffer::handle() always returns 0, i.e., the standard OpenGL framebuffer. More...
 
void activate (EFramebufferBind target=FBB_FRAMEBUFFER)
 Activates the Framebuffer by calling bindFramebuffer() and bindDrawBuffers() More...
 
virtual void bindFramebuffer (EFramebufferBind target=FBB_FRAMEBUFFER)
 Calls glBindFramebuffer(target, 0) thus activating the the framebuffer 0, that is, the normal OpenGL buffers. More...
 
void bindReadBuffer ()
 Binds to the currently active framebuffer object (including the 0 one) the read buffer specified by setReadBuffer(). More...
 
void bindDrawBuffers () const
 Binds to the currently active framebuffer object (including the 0 one) the draw buffers specified by setDrawBuffers(). More...
 
bool checkDrawBuffers () const
 Returns true if the draw buffers bound to this render target are legal for this render target type. More...
 
void setDrawBuffer (EReadDrawBuffer draw_buffer)
 Specifies the color buffer to be drawn into. More...
 
void setDrawBuffers (EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2)
 Specifies a list of color buffers to be drawn into. More...
 
void setDrawBuffers (EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3)
 Specifies a list of color buffers to be drawn into. More...
 
void setDrawBuffers (EReadDrawBuffer draw_buffer1, EReadDrawBuffer draw_buffer2, EReadDrawBuffer draw_buffer3, EReadDrawBuffer draw_buffer4)
 Specifies a list of color buffers to be drawn into. More...
 
void setDrawBuffers (const std::vector< EReadDrawBuffer > &draw_buffers)
 Specifies a list of color buffers to be drawn into. More...
 
const std::vector< EReadDrawBuffer > & drawBuffers ()
 The color buffers to be drawn into. More...
 
EReadDrawBuffer readBuffer () const
 The read-buffer bound when the render target is activated. More...
 
void setReadBuffer (EReadDrawBuffer read_buffer)
 The read-buffer bound when the render target is activated. More...
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Friends

class OpenGLContext
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

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

See also
OpenGLContext::framebuffer() and FramebufferObject

Definition at line 49 of file Framebuffer.hpp.

Constructor & Destructor Documentation

◆ Framebuffer()

vl::Framebuffer::Framebuffer ( OpenGLContext ctx,
int  w,
int  h,
EReadDrawBuffer  draw_buffer,
EReadDrawBuffer  read_buffer 
)
inline

Constructor, see also OpenGLContext::framebuffer().

Definition at line 57 of file Framebuffer.hpp.

Member Function Documentation

◆ activate()

void vl::Framebuffer::activate ( EFramebufferBind  target = FBB_FRAMEBUFFER)
inline

◆ bindDrawBuffers()

void Framebuffer::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 Framebuffer.cpp.

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

◆ bindFramebuffer()

virtual void vl::Framebuffer::bindFramebuffer ( EFramebufferBind  target = FBB_FRAMEBUFFER)
inlinevirtual

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

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

Reimplemented in vl::FramebufferObject.

Definition at line 96 of file Framebuffer.hpp.

References vl::FBB_DRAW_FRAMEBUFFER, vl::FBB_FRAMEBUFFER, vl::FBB_READ_FRAMEBUFFER, and VL_CHECK_OGL.

◆ bindReadBuffer()

void Framebuffer::bindReadBuffer ( )

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

Definition at line 159 of file Framebuffer.cpp.

References readBuffer(), and VL_CHECK_OGL.

◆ checkDrawBuffers()

bool Framebuffer::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 Framebuffer.cpp.

References vl::Log::error().

Referenced by bindDrawBuffers().

◆ drawBuffers()

const std::vector< EReadDrawBuffer >& vl::Framebuffer::drawBuffers ( )
inline

The color buffers to be drawn into.

Definition at line 165 of file Framebuffer.hpp.

◆ handle()

virtual GLuint vl::Framebuffer::handle ( ) const
inlinevirtual

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

Reimplemented in vl::FramebufferObject.

Definition at line 84 of file Framebuffer.hpp.

◆ height()

int vl::Framebuffer::height ( ) const
inline

◆ openglContext() [1/2]

OpenGLContext* vl::Framebuffer::openglContext ( )
inline

◆ openglContext() [2/2]

const OpenGLContext* vl::Framebuffer::openglContext ( ) const
inline

The OpenGLContext bound to a render target.

Definition at line 69 of file Framebuffer.hpp.

◆ readBuffer()

EReadDrawBuffer vl::Framebuffer::readBuffer ( ) const
inline

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

Definition at line 168 of file Framebuffer.hpp.

Referenced by bindReadBuffer().

◆ setDrawBuffer()

void vl::Framebuffer::setDrawBuffer ( EReadDrawBuffer  draw_buffer)
inline

Specifies the color buffer to be drawn into.

Definition at line 128 of file Framebuffer.hpp.

◆ setDrawBuffers() [1/4]

void vl::Framebuffer::setDrawBuffers ( EReadDrawBuffer  draw_buffer1,
EReadDrawBuffer  draw_buffer2 
)
inline

Specifies a list of color buffers to be drawn into.

Definition at line 135 of file Framebuffer.hpp.

◆ setDrawBuffers() [2/4]

void vl::Framebuffer::setDrawBuffers ( EReadDrawBuffer  draw_buffer1,
EReadDrawBuffer  draw_buffer2,
EReadDrawBuffer  draw_buffer3 
)
inline

Specifies a list of color buffers to be drawn into.

Definition at line 143 of file Framebuffer.hpp.

◆ setDrawBuffers() [3/4]

void vl::Framebuffer::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 152 of file Framebuffer.hpp.

◆ setDrawBuffers() [4/4]

void vl::Framebuffer::setDrawBuffers ( const std::vector< EReadDrawBuffer > &  draw_buffers)
inline

Specifies a list of color buffers to be drawn into.

Definition at line 162 of file Framebuffer.hpp.

◆ setHeight()

void vl::Framebuffer::setHeight ( int  height)
inline

The height of a render target.

Definition at line 81 of file Framebuffer.hpp.

Referenced by vlGLUT::GLUTWindow::glut_reshape_func(), vlWin32::Win32Window::WindowProc(), and vlEGL::EGLWindow::WindowProc().

◆ setReadBuffer()

void vl::Framebuffer::setReadBuffer ( EReadDrawBuffer  read_buffer)
inline

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

Definition at line 171 of file Framebuffer.hpp.

◆ setWidth()

void vl::Framebuffer::setWidth ( int  width)
inline

The width of a render target.

Definition at line 78 of file Framebuffer.hpp.

Referenced by vlGLUT::GLUTWindow::glut_reshape_func(), vlWin32::Win32Window::WindowProc(), and vlEGL::EGLWindow::WindowProc().

◆ width()

int vl::Framebuffer::width ( ) const
inline

Friends And Related Function Documentation

◆ OpenGLContext

friend class OpenGLContext
friend

Definition at line 53 of file Framebuffer.hpp.


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