VTK
|
Interface to OpenGL framebuffer object. More...
#include <vtkFrameBufferObject2.h>
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual int | IsA (const char *type) |
vtkFrameBufferObject2 * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) |
void | Bind (unsigned int mode) |
void | UnBind (unsigned int mode) |
void | SaveCurrentBindings () |
void | AddTexColorAttachment (unsigned int mode, unsigned int attId, unsigned int handle) |
void | RemoveTexColorAttachments (unsigned int mode, unsigned int num) |
void | RemoveTexColorAttachment (unsigned int mode, unsigned int attId) |
void | AddRenColorAttachment (unsigned int mode, unsigned int attId, unsigned int handle) |
void | RemoveRenColorAttachments (unsigned int mode, unsigned int num) |
void | RemoveRenColorAttachment (unsigned int mode, unsigned int attId) |
int | CheckFrameBufferStatus (unsigned int mode) |
vtkPixelBufferObject * | DownloadColor3 (int extent[4], int vtkType) |
vtkPixelBufferObject * | DownloadColor4 (int extent[4], int vtkType) |
void | SetContext (vtkRenderWindow *context) |
vtkRenderWindow * | GetContext () |
void | SaveCurrentBuffers () |
void | RestorePreviousBuffers (unsigned int mode) |
void | AddColorAttachment (unsigned int mode, unsigned int attId, vtkTextureObject *tex) |
void | AddColorAttachment (unsigned int mode, unsigned int attId, vtkRenderbuffer *tex) |
void | AddDepthAttachment (unsigned int mode, vtkTextureObject *tex) |
void | AddTexDepthAttachment (unsigned int mode, unsigned int handle) |
void | RemoveTexDepthAttachment (unsigned int mode) |
void | AddDepthAttachment (unsigned int mode, vtkRenderbuffer *tex) |
void | AddRenDepthAttachment (unsigned int mode, unsigned int handle) |
void | RemoveRenDepthAttachment (unsigned int mode) |
void | ActivateDrawBuffer (unsigned int id) |
void | ActivateReadBuffer (unsigned int id) |
void | DeactivateReadBuffer () |
void | ActivateDrawBuffers (unsigned int n) |
void | ActivateDrawBuffers (unsigned int *ids, int n) |
void | DeactivateDrawBuffers () |
vtkPixelBufferObject * | DownloadColor1 (int extent[4], int vtkType, int channel) |
vtkPixelBufferObject * | DownloadDepth (int extent[4], int vtkType) |
vtkPixelBufferObject * | Download (int extent[4], int vtkType, int nComps, int oglType, int oglFormat) |
Static Public Member Functions | |
static vtkFrameBufferObject2 * | New () |
static int | IsTypeOf (const char *type) |
static vtkFrameBufferObject2 * | SafeDownCast (vtkObjectBase *o) |
static bool | IsSupported (vtkRenderWindow *renWin) |
static void | Download (int extent[4], int vtkType, int nComps, int oglType, int oglFormat, vtkPixelBufferObject *pbo) |
static void | InitializeViewport (int width, int height) |
static bool | GetFrameBufferStatus (unsigned int mode, const char *&desc) |
static int | Blit (int srcExt[4], int destExt[4], unsigned int bits, unsigned int mapping) |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
void | CreateFBO () |
void | DestroyFBO () |
int | GetOpenGLType (int vtkType) |
vtkFrameBufferObject2 () | |
~vtkFrameBufferObject2 () | |
Static Protected Member Functions | |
static bool | LoadRequiredExtensions (vtkRenderWindow *renWin) |
Protected Attributes | |
vtkWeakPointer< vtkRenderWindow > | Context |
unsigned int | FBOIndex |
unsigned int | PreviousDrawFBO |
unsigned int | PreviousReadFBO |
unsigned int | DepthBuffer |
unsigned int | PreviousDrawBuffer |
unsigned int | PreviousReadBuffer |
Friends | |
class | vtkRenderbuffer |
Interface to OpenGL framebuffer object.
A light and efficient interface to an OpenGL Frame Buffer Object. Use is very simillalry to directly calling OpenGL, but as vtkObject it may safely stored, shared, or passed around. It supports FBO Blit and transfer to Pixel Buffer Object.
Typical use case:
{.cpp} vtkFrameBufferObject2 *fbo = this->Internals->FBO; fbo->SaveCurrentBindings(); fbo->Bind(vtkgl::FRAMEBUFFER_EXT); fbo->AddDepthAttachment(vtkgl::DRAW_FRAMEBUFFER_EXT, depthBuffer); fbo->AddColorAttachment(vtkgl::DRAW_FRAMEBUFFER_EXT, 0U, colorTex1); fbo->AddColorAttachment(vtkgl::DRAW_FRAMEBUFFER_EXT, 1U, colorTex2); fbo->AddColorAttachment(vtkgl::DRAW_FRAMEBUFFER_EXT, 2U, colorTex3); fbo->ActivateDrawBuffers(3); vtkCheckFrameBufferStatusMacro(vtkgl::FRAMEBUFFER_EXT); ... fbo->UnBind(vtkgl::FRAMEBUFFER_EXT);
@sa
vtkRenderbuffer, vtkPixelBufferObject
Definition at line 85 of file vtkFrameBufferObject2.h.
Reimplemented from vtkObject.
Definition at line 89 of file vtkFrameBufferObject2.h.
vtkFrameBufferObject2::vtkFrameBufferObject2 | ( | ) | [protected] |
vtkFrameBufferObject2::~vtkFrameBufferObject2 | ( | ) | [protected] |
static vtkFrameBufferObject2* vtkFrameBufferObject2::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
static int vtkFrameBufferObject2::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
virtual int vtkFrameBufferObject2::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
static vtkFrameBufferObject2* vtkFrameBufferObject2::SafeDownCast | ( | vtkObjectBase * | o | ) | [static] |
Reimplemented from vtkObject.
virtual vtkObjectBase* vtkFrameBufferObject2::NewInstanceInternal | ( | ) | const [protected, virtual] |
Reimplemented from vtkObject.
Reimplemented from vtkObject.
void vtkFrameBufferObject2::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) | [virtual] |
void vtkFrameBufferObject2::SetContext | ( | vtkRenderWindow * | context | ) |
Get/Set the context. Context must be a vtkOpenGLRenderWindow. This does not increase the reference count of the context to avoid reference loops. SetContext() may raise an error is the OpenGL context does not support the required OpenGL extensions.
Get/Set the context. Context must be a vtkOpenGLRenderWindow. This does not increase the reference count of the context to avoid reference loops. SetContext() may raise an error is the OpenGL context does not support the required OpenGL extensions.
static bool vtkFrameBufferObject2::IsSupported | ( | vtkRenderWindow * | renWin | ) | [static] |
Returns if the context supports the required extensions. Extension will be loaded when the conetxt is set.
void vtkFrameBufferObject2::Bind | ( | unsigned int | mode | ) |
Bind FBO to FRAMEBUFFER, DRAW_FRAMEBUFFER or READ_FRAMEBUFFER The current binding is not saved, nor restored. (see glBindFramebuffer) This method can be used to prepare for FBO Blit or buffer ping-pong. Low level api.
void vtkFrameBufferObject2::UnBind | ( | unsigned int | mode | ) |
Bind saved FBO (see SaveCurrentBindings) for DRAW or READ (see glBindFramebuffer) If no bindings were saved bind to default FBO. Low level api.
Store the current framebuffer bindings. If this method is called then UnBind will restore the saved value accoring to its mode (DRAW_FRAMEBUFFER,READ_FRAMEBUFFER,FRAMEBUFFER) Restoration occurs in UnBind. Low level api
Store the current draw and read buffers. When restored only the buffers matching mode are modified. DRAW_FRAMEBUFFER -> glDrawBuffer READ_FRAMEBUFFER -> glReadBuffer FRAMEBUFFER -> both
void vtkFrameBufferObject2::RestorePreviousBuffers | ( | unsigned int | mode | ) |
Store the current draw and read buffers. When restored only the buffers matching mode are modified. DRAW_FRAMEBUFFER -> glDrawBuffer READ_FRAMEBUFFER -> glReadBuffer FRAMEBUFFER -> both
void vtkFrameBufferObject2::AddColorAttachment | ( | unsigned int | mode, |
unsigned int | attId, | ||
vtkTextureObject * | tex | ||
) |
Directly assign/remove a texture to color attachments.
void vtkFrameBufferObject2::AddTexColorAttachment | ( | unsigned int | mode, |
unsigned int | attId, | ||
unsigned int | handle | ||
) |
void vtkFrameBufferObject2::RemoveTexColorAttachments | ( | unsigned int | mode, |
unsigned int | num | ||
) |
void vtkFrameBufferObject2::RemoveTexColorAttachment | ( | unsigned int | mode, |
unsigned int | attId | ||
) | [inline] |
Definition at line 144 of file vtkFrameBufferObject2.h.
void vtkFrameBufferObject2::AddColorAttachment | ( | unsigned int | mode, |
unsigned int | attId, | ||
vtkRenderbuffer * | tex | ||
) |
Directly assign/remove a renderbuffer to color attachments.
void vtkFrameBufferObject2::AddRenColorAttachment | ( | unsigned int | mode, |
unsigned int | attId, | ||
unsigned int | handle | ||
) |
void vtkFrameBufferObject2::RemoveRenColorAttachments | ( | unsigned int | mode, |
unsigned int | num | ||
) |
void vtkFrameBufferObject2::RemoveRenColorAttachment | ( | unsigned int | mode, |
unsigned int | attId | ||
) | [inline] |
Definition at line 161 of file vtkFrameBufferObject2.h.
void vtkFrameBufferObject2::AddDepthAttachment | ( | unsigned int | mode, |
vtkTextureObject * | tex | ||
) |
Directly assign/remove a texture/renderbuffer to depth attachments.
void vtkFrameBufferObject2::AddTexDepthAttachment | ( | unsigned int | mode, |
unsigned int | handle | ||
) |
Directly assign/remove a texture/renderbuffer to depth attachments.
void vtkFrameBufferObject2::RemoveTexDepthAttachment | ( | unsigned int | mode | ) | [inline] |
Directly assign/remove a texture/renderbuffer to depth attachments.
Definition at line 168 of file vtkFrameBufferObject2.h.
void vtkFrameBufferObject2::AddDepthAttachment | ( | unsigned int | mode, |
vtkRenderbuffer * | tex | ||
) |
Directly assign/remove a renderbuffer to depth attachments.
void vtkFrameBufferObject2::AddRenDepthAttachment | ( | unsigned int | mode, |
unsigned int | handle | ||
) |
Directly assign/remove a renderbuffer to depth attachments.
void vtkFrameBufferObject2::RemoveRenDepthAttachment | ( | unsigned int | mode | ) | [inline] |
Directly assign/remove a renderbuffer to depth attachments.
Definition at line 176 of file vtkFrameBufferObject2.h.
void vtkFrameBufferObject2::ActivateDrawBuffer | ( | unsigned int | id | ) |
Select a single specific draw or read buffer (zero based)
void vtkFrameBufferObject2::ActivateReadBuffer | ( | unsigned int | id | ) |
Select a single specific draw or read buffer (zero based)
Select a single specific draw or read buffer (zero based)
void vtkFrameBufferObject2::ActivateDrawBuffers | ( | unsigned int | n | ) |
Select n consecutive write attachments. Low level api.
void vtkFrameBufferObject2::ActivateDrawBuffers | ( | unsigned int * | ids, |
int | n | ||
) |
Select n consecutive write attachments. Low level api.
Select n consecutive write attachments. Low level api.
static void vtkFrameBufferObject2::InitializeViewport | ( | int | width, |
int | height | ||
) | [static] |
Set up ortho viewport with scissor, lighting, blend, and depth disabled. The method affects the current bound FBO. The method is static so that it may be used on the default FBO without an instance. Low level api.
int vtkFrameBufferObject2::CheckFrameBufferStatus | ( | unsigned int | mode | ) |
Validate the current FBO configuration (attachments, formats, etc) prints detected errors to vtkErrorMacro. Low level api.
static bool vtkFrameBufferObject2::GetFrameBufferStatus | ( | unsigned int | mode, |
const char *& | desc | ||
) | [static] |
Validate the current FBO configuration (attachments, formats, etc) return false if the FBO is incomplete. Assigns description a literal containing a description of the status. Low level api.
static int vtkFrameBufferObject2::Blit | ( | int | srcExt[4], |
int | destExt[4], | ||
unsigned int | bits, | ||
unsigned int | mapping | ||
) | [static] |
Copy from the currently bound READ FBO to the currently bound DRAW FBO. The method is static so that one doesn't need to ccreate an instance when transfering between attachments in the default FBO.
vtkPixelBufferObject* vtkFrameBufferObject2::DownloadColor1 | ( | int | extent[4], |
int | vtkType, | ||
int | channel | ||
) |
Download data from the read color attachment of the currently bound FBO into the retruned PBO. The PBO must be free'd when you are finished with it. The number of components in the PBO is the same as in the name of the specific download fucntion. When downloading a single color channel, the channel must be identified by index, 1->red, 2->green, 3-> blue.
vtkPixelBufferObject* vtkFrameBufferObject2::DownloadColor3 | ( | int | extent[4], |
int | vtkType | ||
) |
vtkPixelBufferObject* vtkFrameBufferObject2::DownloadColor4 | ( | int | extent[4], |
int | vtkType | ||
) |
vtkPixelBufferObject* vtkFrameBufferObject2::DownloadDepth | ( | int | extent[4], |
int | vtkType | ||
) |
Download data from the depth attachment of the currently bound FBO. The returned PBO must be Delete'd by the caller. The retruned PBO has one component.
vtkPixelBufferObject* vtkFrameBufferObject2::Download | ( | int | extent[4], |
int | vtkType, | ||
int | nComps, | ||
int | oglType, | ||
int | oglFormat | ||
) |
Download data from the read buffer of the current FBO. These are low level meothds. In the static variant a PBO must be passed in since we don't have access to a context. The static method is provided so that one may download from the default FBO.
static void vtkFrameBufferObject2::Download | ( | int | extent[4], |
int | vtkType, | ||
int | nComps, | ||
int | oglType, | ||
int | oglFormat, | ||
vtkPixelBufferObject * | pbo | ||
) | [static] |
static bool vtkFrameBufferObject2::LoadRequiredExtensions | ( | vtkRenderWindow * | renWin | ) | [static, protected] |
Load all necessary extensions.
void vtkFrameBufferObject2::CreateFBO | ( | ) | [protected] |
void vtkFrameBufferObject2::DestroyFBO | ( | ) | [protected] |
int vtkFrameBufferObject2::GetOpenGLType | ( | int | vtkType | ) | [protected] |
Given a vtk type get a compatible open gl type.
friend class vtkRenderbuffer [friend] |
Definition at line 315 of file vtkFrameBufferObject2.h.
vtkWeakPointer<vtkRenderWindow> vtkFrameBufferObject2::Context [protected] |
Definition at line 302 of file vtkFrameBufferObject2.h.
unsigned int vtkFrameBufferObject2::FBOIndex [protected] |
Definition at line 304 of file vtkFrameBufferObject2.h.
unsigned int vtkFrameBufferObject2::PreviousDrawFBO [protected] |
Definition at line 305 of file vtkFrameBufferObject2.h.
unsigned int vtkFrameBufferObject2::PreviousReadFBO [protected] |
Definition at line 306 of file vtkFrameBufferObject2.h.
unsigned int vtkFrameBufferObject2::DepthBuffer [protected] |
Definition at line 307 of file vtkFrameBufferObject2.h.
unsigned int vtkFrameBufferObject2::PreviousDrawBuffer [protected] |
Definition at line 308 of file vtkFrameBufferObject2.h.
unsigned int vtkFrameBufferObject2::PreviousReadBuffer [protected] |
Definition at line 309 of file vtkFrameBufferObject2.h.