|
virtual vtkTypeBool | IsA (const char *type) |
| Return 1 if this class is the same type of (or a subclass of) the named class. More...
|
|
vtkOpenGLFramebufferObject * | NewInstance () const |
|
void | PrintSelf (ostream &os, vtkIndent indent) override |
| Methods invoked by print to print information about the object including superclasses. More...
|
|
void | Bind () |
| Make the draw frame buffer active. More...
|
|
void | Bind (unsigned int mode) |
|
void | UnBind () |
| Unbind this buffer. More...
|
|
void | UnBind (unsigned int mode) |
|
void | InitializeViewport (int width, int height) |
| Set up ortho viewport with scissor, lighting, blend, and depth disabled. More...
|
|
virtual unsigned int | GetActiveReadBuffer () |
|
unsigned int | GetActiveDrawBuffer (unsigned int id) |
|
void | RenderQuad (int minX, int maxX, int minY, int maxY, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao) |
| Renders a quad at the given location with pixel coordinates. More...
|
|
vtkTextureObject * | GetColorAttachmentAsTextureObject (unsigned int num) |
| Return the texture object bound to the passed attachment number. More...
|
|
int | GetNumberOfColorAttachments () |
| Return the number of color attachments for the given mode. More...
|
|
unsigned int | GetMaximumNumberOfActiveTargets () |
| Returns the maximum number of targets that can be rendered to at one time. More...
|
|
unsigned int | GetMaximumNumberOfRenderTargets () |
| Returns the maximum number of render targets available. More...
|
|
int | CheckFrameBufferStatus (unsigned int mode) |
| Validate the current FBO configuration (attachments, formats, etc) prints detected errors to vtkErrorMacro. More...
|
|
virtual void | ReleaseGraphicsResources (vtkWindow *win) |
| Deactivate and UnBind. More...
|
|
virtual unsigned int | GetFBOIndex () |
|
vtkPixelBufferObject * | DownloadColor1 (int extent[4], int vtkType, int channel) |
| Download data from the read color attachment of the currently bound FBO into the returned PBO. More...
|
|
vtkPixelBufferObject * | DownloadColor3 (int extent[4], int vtkType) |
|
vtkPixelBufferObject * | DownloadColor4 (int extent[4], int vtkType) |
|
vtkPixelBufferObject * | DownloadDepth (int extent[4], int vtkType) |
| Download data from the depth attachment of the currently bound FBO. More...
|
|
vtkPixelBufferObject * | Download (int extent[4], int vtkType, int nComps, int oglType, int oglFormat) |
| Download data from the read buffer of the current FBO. More...
|
|
void | Resize (int width, int height) |
| Resize all FO attachments. More...
|
|
int | GetMultiSamples () |
|
|
void | SetContext (vtkRenderWindow *context) |
| Get/Set the context. More...
|
|
vtkOpenGLRenderWindow * | GetContext () |
| Get/Set the context. More...
|
|
|
void | SaveCurrentBindingsAndBuffers () |
| Store/Restore the current framebuffer bindings and buffers. More...
|
|
void | SaveCurrentBindingsAndBuffers (unsigned int mode) |
| Store/Restore the current framebuffer bindings and buffers. More...
|
|
void | RestorePreviousBindingsAndBuffers () |
| Store/Restore the current framebuffer bindings and buffers. More...
|
|
void | RestorePreviousBindingsAndBuffers (unsigned int mode) |
| Store/Restore the current framebuffer bindings and buffers. More...
|
|
|
bool | Start (int width, int height) |
| User must take care that width/height match the dimensions of the user defined texture attachments. More...
|
|
bool | StartNonOrtho (int width, int height) |
| User must take care that width/height match the dimensions of the user defined texture attachments. More...
|
|
|
void | ActivateDrawBuffers (unsigned int n) |
|
void | ActivateDrawBuffers (unsigned int *ids, int n) |
|
void | ActivateDrawBuffer (unsigned int id) |
|
void | ActivateReadBuffer (unsigned int id) |
|
void | ActivateBuffer (unsigned int id) |
|
void | DeactivateDrawBuffers () |
|
void | DeactivateReadBuffer () |
|
|
void | AddColorAttachment (unsigned int attId, vtkTextureObject *tex, unsigned int zslice=0, unsigned int format=0, unsigned int mipmapLevel=0) |
| Directly assign/remove a texture to color attachments. More...
|
|
void | AddColorAttachment (unsigned int attId, vtkRenderbuffer *tex) |
| Directly assign/remove a texture to color attachments. More...
|
|
void | RemoveColorAttachment (unsigned int index) |
| Directly assign/remove a texture to color attachments. More...
|
|
void | RemoveColorAttachments (unsigned int num) |
| Directly assign/remove a texture to color attachments. More...
|
|
|
void | AddDepthAttachment () |
| Directly assign/remove a texture/renderbuffer to depth attachments. More...
|
|
void | AddDepthAttachment (vtkTextureObject *tex) |
| Directly assign/remove a texture/renderbuffer to depth attachments. More...
|
|
void | AddDepthAttachment (vtkRenderbuffer *tex) |
| Directly assign/remove a texture/renderbuffer to depth attachments. More...
|
|
void | RemoveDepthAttachment () |
| Directly assign/remove a texture/renderbuffer to depth attachments. More...
|
|
vtkTextureObject * | GetDepthAttachmentAsTextureObject () |
| Directly assign/remove a texture/renderbuffer to depth attachments. More...
|
|
|
bool | PopulateFramebuffer (int width, int height) |
| Convenience method to populate a framebuffer with attachments created as well. More...
|
|
bool | PopulateFramebuffer (int width, int height, bool useTextures, int numberOfColorAttachments, int colorDataType, bool wantDepthAttachment, int depthBitplanes, int multisamples, bool wantStencilAttachment=false) |
| Convenience method to populate a framebuffer with attachments created as well. More...
|
|
|
int * | GetLastSize () override |
| Dimensions in pixels of the framebuffer. More...
|
|
void | GetLastSize (int &_arg1, int &_arg2) override |
| Dimensions in pixels of the framebuffer. More...
|
|
void | GetLastSize (int _arg[2]) override |
| Dimensions in pixels of the framebuffer. More...
|
|
virtual vtkTypeBool | IsA (const char *type) |
| Return 1 if this class is the same type of (or a subclass of) the named class. More...
|
|
vtkFrameBufferObjectBase * | NewInstance () const |
|
void | PrintSelf (ostream &os, vtkIndent indent) override |
| Methods invoked by print to print information about the object including superclasses. More...
|
|
| vtkBaseTypeMacro (vtkObject, vtkObjectBase) |
|
virtual void | DebugOn () |
| Turn debugging output on. More...
|
|
virtual void | DebugOff () |
| Turn debugging output off. More...
|
|
bool | GetDebug () |
| Get the value of the debug flag. More...
|
|
void | SetDebug (bool debugFlag) |
| Set the value of the debug flag. More...
|
|
virtual void | Modified () |
| Update the modification time for this object. More...
|
|
virtual vtkMTimeType | GetMTime () |
| Return this object's modified time. More...
|
|
void | PrintSelf (ostream &os, vtkIndent indent) override |
| Methods invoked by print to print information about the object including superclasses. More...
|
|
void | RemoveObserver (unsigned long tag) |
|
void | RemoveObservers (unsigned long event) |
|
void | RemoveObservers (const char *event) |
|
void | RemoveAllObservers () |
|
vtkTypeBool | HasObserver (unsigned long event) |
|
vtkTypeBool | HasObserver (const char *event) |
|
int | InvokeEvent (unsigned long event) |
|
int | InvokeEvent (const char *event) |
|
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
|
|
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
|
|
vtkCommand * | GetCommand (unsigned long tag) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
|
|
void | RemoveObserver (vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
|
|
void | RemoveObservers (unsigned long event, vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
|
|
void | RemoveObservers (const char *event, vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
|
|
vtkTypeBool | HasObserver (unsigned long event, vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
|
|
vtkTypeBool | HasObserver (const char *event, vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
|
|
template<class U , class T > |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
| Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
|
|
template<class U , class T > |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
| Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
|
|
template<class U , class T > |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
| Allow user to set the AbortFlagOn() with the return value of the callback method. More...
|
|
int | InvokeEvent (unsigned long event, void *callData) |
| This method invokes an event and return whether the event was aborted or not. More...
|
|
int | InvokeEvent (const char *event, void *callData) |
| This method invokes an event and return whether the event was aborted or not. More...
|
|
const char * | GetClassName () const |
| Return the class name as a string. More...
|
|
virtual vtkTypeBool | IsA (const char *name) |
| Return 1 if this class is the same type of (or a subclass of) the named class. More...
|
|
virtual vtkIdType | GetNumberOfGenerationsFromBase (const char *name) |
| Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). More...
|
|
virtual void | Delete () |
| Delete a VTK object. More...
|
|
virtual void | FastDelete () |
| Delete a reference to this object. More...
|
|
void | InitializeObjectBase () |
|
void | Print (ostream &os) |
| Print an object to an ostream. More...
|
|
virtual void | Register (vtkObjectBase *o) |
| Increase the reference count (mark as used by another object). More...
|
|
virtual void | UnRegister (vtkObjectBase *o) |
| Decrease the reference count (release by another object). More...
|
|
int | GetReferenceCount () |
| Return the current reference count of this object. More...
|
|
void | SetReferenceCount (int) |
| Sets the reference count. More...
|
|
bool | GetIsInMemkind () const |
| A local state flag that remembers whether this object lives in the normal or extended memory space. More...
|
|
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
| Methods invoked by print to print information about the object including superclasses. More...
|
|
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
| Methods invoked by print to print information about the object including superclasses. More...
|
|
|
static vtkOpenGLFramebufferObject * | New () |
|
static vtkTypeBool | IsTypeOf (const char *type) |
|
static vtkOpenGLFramebufferObject * | SafeDownCast (vtkObjectBase *o) |
|
static bool | IsSupported (vtkOpenGLRenderWindow *) |
| Returns if the context supports the required extensions. More...
|
|
static bool | GetFrameBufferStatus (unsigned int mode, const char *&desc) |
| Validate the current FBO configuration (attachments, formats, etc) return false if the FBO is incomplete. More...
|
|
static int | Blit (const int srcExt[4], const int destExt[4], unsigned int bits, unsigned int mapping) |
| Copy from the currently bound READ FBO to the currently bound DRAW FBO. More...
|
|
static void | Download (int extent[4], int vtkType, int nComps, int oglType, int oglFormat, vtkPixelBufferObject *pbo) |
|
static unsigned int | GetDrawMode () |
|
static unsigned int | GetReadMode () |
|
static unsigned int | GetBothMode () |
|
static vtkTypeBool | IsTypeOf (const char *type) |
|
static vtkFrameBufferObjectBase * | SafeDownCast (vtkObjectBase *o) |
|
static vtkObject * | New () |
| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
|
|
static void | BreakOnError () |
| This method is called when vtkErrorMacro executes. More...
|
|
static void | SetGlobalWarningDisplay (int val) |
| This is a global flag that controls whether any debug, warning or error messages are displayed. More...
|
|
static void | GlobalWarningDisplayOn () |
| This is a global flag that controls whether any debug, warning or error messages are displayed. More...
|
|
static void | GlobalWarningDisplayOff () |
| This is a global flag that controls whether any debug, warning or error messages are displayed. More...
|
|
static int | GetGlobalWarningDisplay () |
| This is a global flag that controls whether any debug, warning or error messages are displayed. More...
|
|
static vtkTypeBool | IsTypeOf (const char *name) |
| Return 1 if this class type is the same type of (or a subclass of) the named class. More...
|
|
static vtkIdType | GetNumberOfGenerationsFromBaseType (const char *name) |
| Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). More...
|
|
static vtkObjectBase * | New () |
| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
|
|
static void | SetMemkindDirectory (const char *directoryname) |
| The name of a directory, ideally mounted -o dax, to memory map an extended memory space within. More...
|
|
static bool | GetUsingMemkind () |
| A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space. More...
|
|
Internal class which encapsulates OpenGL FramebufferObject.
Before delving into this class it is best to have some background in some OpenGL terms. OpenGL has a notion of a currently bound Framebuffers for drawing and reading. It can be the default framebuffer such as created with a standard window/context or it can be a user created Framebuffer objects. When draw and read commands are invoked, they apply to the current draw and/or read frambuffers.
A framebuffer consists of color buffers and an optional depth buffer. The FramebufferObject does not hold the memory for these buffers, it just keeps track of what buffers are attached to it. The buffers themselves hold the storage for the pixels/depths.
In the context of this discussion a buffer can be either a vtkTextureObject (both 2D or a slice of a 3D texture) or a vtkRenderbuffer. In some cases a renderbuffer may be faster or more lightweight but you cannot pass a renderbuffer into a shader for sampling in a later pass like you can a texture.
You attach these buffers to the Framebuffer using methods such as AddColorAttachment or AddDepthAttachment In normal usage a buffer is Attached to a FramebufferObject and then some or all of the attached buffers are activated for drawing or reading.
When you have a framebuffer bound along with some buffers attached to it you can then activate specific buffers for drawing or reading. So you have draw and read framebuffer objects (bindings) and then for the currently bound FramebufferObjects you have active draw and read buffers.
A single FramebufferObject can be bound to both Draw and Read. You cannot assign and activate a TextureObject for drawing on the FO and at the same time pass it in as a Texture to the shader program. That type of operation is very common and must be done in two steps.
- Render to the FO with the Texture attached as an active buffer
- deactivate the texture obj and then render with the texture obj as a texture passed into the shader
Typical use cases: The simplest example
fbo->SetContext(renWin);
fbo->SaveCurrentBindingsAndBuffers();
fbo->PopulateFramebuffer(width,
height);
...
fbo->RestorePreviousBindingsAndBuffers();
If you wish to use a texture you created
fbo->SetContext(renWin);
fbo->SaveCurrentBindingsAndBuffers();
fbo->Bind();
fbo->AddColorAttachment(0, vtkTextureObj);
fbo->AddDepthAttachment();
fbo->ActivateBuffer(0);
...
fbo->RestorePreviousBindingsAndBuffers();
If you will be using a FO repeatedly then it is best to create it attach the buffers and then use as needed for example
Typical use case:
fbo->SetContext(renWin);
fbo->SaveCurrentBindingsAndBuffers();
fbo->AddColorAttachment(0, vtkTextureObj);
fbo->AddDepthAttachment();
fbo->RestorePreviousBindingsAndBuffers();
fbo->SaveCurrentBindingsAndBuffers();
fbo->Bind();
fbo->ActivateBuffer(0);
...
fbo->RestorePreviousBindingsAndBuffers();
If you with to only bind the framebuffer for drawing or reading there are mode specific versions of some methods that only apply to the mode specified Draw/Read/Both. The mode argument uses OpenGL constants so this class provides convenience methods to return them named GetDrawMode() GetReadMode() and GetBothMode() so that your code does not need to be polluted with OpenGL headers/constants.
This class replaces both vtkFrameBufferObject and vtkFrameBufferObject2 and contins methods from both of them. Most methods from FO2 should work with this class. Just rename FBO2 to FBO and make sure to Save and Restore the bindings and buffers. If you have been using the old FO class, which had comments in the header saying not to use it. Then you are in for a bit more of a conversion but generally it should still be easy. Use the code samples above (or any of the classes in OpenGL2 that currently use FBOs) to guide you. They have all been converted to this class. Where previously a DepthBuffer was automatically created for you, you now need to do it explicitly using AddDepthAttachment().
Note the capitalization of FramebufferObject
- See also
- vtkTextureObject, vtkRenderbufferObject
Definition at line 181 of file vtkOpenGLFramebufferObject.h.