|
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 | SetContext (vtkRenderWindow *context) |
| Get/Set the context. More...
|
|
vtkOpenGLRenderWindow * | GetContext () |
|
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 | SaveCurrentBindings () |
| Store/Restore the current framebuffer bindings and buffers. More...
|
|
void | SaveCurrentBindings (unsigned int mode) |
|
void | SaveCurrentBindingsAndBuffers () |
|
void | SaveCurrentBindingsAndBuffers (unsigned int mode) |
|
void | RestorePreviousBindings () |
|
void | RestorePreviousBindings (unsigned int mode) |
|
void | RestorePreviousBindingsAndBuffers () |
|
void | RestorePreviousBindingsAndBuffers (unsigned int mode) |
|
void | SaveCurrentBuffers () |
| Store the current draw and read buffers. More...
|
|
void | SaveCurrentBuffers (unsigned int mode) |
|
void | RestorePreviousBuffers () |
|
void | RestorePreviousBuffers (unsigned int mode) |
|
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) |
|
void | InitializeViewport (int width, int height) |
| Set up ortho viewport with scissor, lighting, blend, and depth disabled. 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 | RenderQuad (int minX, int maxX, int minY, int maxY, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao) |
| Renders a quad at the given location with pixel coordinates. More...
|
|
void | AddColorAttachment (unsigned int mode, 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 mode, unsigned int attId, vtkRenderbuffer *tex) |
|
void | RemoveColorAttachment (unsigned int mode, unsigned int index) |
|
void | RemoveColorAttachments (unsigned int mode, unsigned int num) |
|
int | GetNumberOfColorAttachments (unsigned int mode) |
| Return the number of color attachments for the given mode. More...
|
|
void | AddDepthAttachment () |
| Directly assign/remove a texture/renderbuffer to depth attachments. More...
|
|
void | AddDepthAttachment (unsigned int mode) |
|
void | AddDepthAttachment (unsigned int mode, vtkTextureObject *tex) |
|
void | AddDepthAttachment (unsigned int mode, vtkRenderbuffer *tex) |
|
void | RemoveDepthAttachment (unsigned int mode) |
|
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) |
|
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 * | GetLastSize () override |
| Dimensions in pixels of the framebuffer. More...
|
|
void | GetLastSize (int &_arg1, int &_arg2) override |
|
void | GetLastSize (int _arg[2]) override |
|
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...
|
|
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...
|
|
void | RemoveTexColorAttachments (unsigned int mode, unsigned int num) |
|
void | RemoveTexColorAttachment (unsigned int mode, unsigned int attId) |
|
void | RemoveRenDepthAttachment (unsigned int mode) |
|
void | RemoveTexDepthAttachment (unsigned int mode) |
|
vtkFrameBufferObjectBase * | NewInstance () const |
|
| 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...
|
|
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) |
|
vtkCommand * | GetCommand (unsigned long tag) |
|
void | RemoveObserver (vtkCommand *) |
|
void | RemoveObservers (unsigned long event, vtkCommand *) |
|
void | RemoveObservers (const char *event, vtkCommand *) |
|
vtkTypeBool | HasObserver (unsigned long event, vtkCommand *) |
|
vtkTypeBool | HasObserver (const char *event, vtkCommand *) |
|
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) |
|
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) |
|
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) |
|
int | InvokeEvent (unsigned long event) |
|
int | InvokeEvent (const char *event) |
|
const char * | GetClassName () const |
| Return the class name as a string. 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 | PrintHeader (ostream &os, vtkIndent indent) |
|
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
|
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...
|
|
void | PrintRevisions (ostream &) |
| Legacy. 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 () |
|
static void | GlobalWarningDisplayOff () |
|
static int | GetGlobalWarningDisplay () |
|
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 vtkObjectBase * | New () |
| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
|
|
|
virtual vtkObjectBase * | NewInstanceInternal () const |
|
void | SetColorBuffer (unsigned int mode, unsigned int index, vtkTextureObject *texture, unsigned int zslice=0, unsigned int format=0, unsigned int mipmapLevel=0) |
|
void | SetColorBuffer (unsigned int mode, unsigned int index, vtkRenderbuffer *rb) |
|
void | SetDepthBuffer (unsigned int mode, vtkTextureObject *depthTexture) |
|
void | SetDepthBuffer (unsigned int mode, vtkRenderbuffer *depthBuffer) |
|
void | Attach () |
| Attach all buffers to the FO if not already done so. More...
|
|
void | AttachColorBuffer (unsigned int mode, unsigned int index) |
| Attach a specific buffer. More...
|
|
void | AttachDepthBuffer (unsigned int mode) |
|
void | CreateFBO () |
|
void | DestroyFBO () |
|
void | DestroyDepthBuffer (vtkWindow *win) |
|
void | DestroyColorBuffers (vtkWindow *win) |
|
void | ActivateBuffers () |
|
void | UpdateSize () |
|
void | DisplayFrameBufferAttachments () |
| Display all the attachments of the current framebuffer object. More...
|
|
void | DisplayFrameBufferAttachment (unsigned int uattachment) |
| Display a given attachment for the current framebuffer object. More...
|
|
void | DisplayDrawBuffers () |
| Display the draw buffers. More...
|
|
void | DisplayReadBuffer () |
| Display the read buffer. More...
|
|
void | DisplayBuffer (int value) |
| Display any buffer (convert value into string). More...
|
|
int | GetOpenGLType (int vtkType) |
| Given a vtk type get a compatible open gl type. More...
|
|
| vtkOpenGLFramebufferObject () |
|
| ~vtkOpenGLFramebufferObject () override |
|
| vtkFrameBufferObjectBase () |
|
| ~vtkFrameBufferObjectBase () override |
|
| vtkObject () |
|
| ~vtkObject () override |
|
void | RegisterInternal (vtkObjectBase *, vtkTypeBool check) override |
|
void | UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override |
|
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr) |
| These methods allow a command to exclusively grab all events. More...
|
|
void | InternalReleaseFocus () |
|
| vtkObjectBase () |
|
virtual | ~vtkObjectBase () |
|
virtual void | CollectRevisions (ostream &) |
|
virtual void | ReportReferences (vtkGarbageCollector *) |
|
| vtkObjectBase (const vtkObjectBase &) |
|
void | operator= (const vtkObjectBase &) |
|
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. Likewise a single buffer can be activated for both draw and read operations. 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->Start();
...
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->Start();
...
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->Bind();
fbo->AddColorAttachment(0, vtkTextureObj);
fbo->AddDepthAttachment();
fbo->RestorePreviousBindingsAndBuffers();
fbo->SaveCurrentBindingsAndBuffers();
fbo->Bind();
fbo->ActivateBuffer(0);
fbo->Start();
...
fbo->RestorePreviousBindingsAndBuffers();
If you with to only bind/attach the draw buffers or read buffers there are mode specific versions of most 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().
This class should be named vtkOpenGLFramebufferObject (FO) Note the capitalization of FramebufferObject
- See also
- vtkTextureObject, vtkRenderbufferObject
Definition at line 182 of file vtkOpenGLFramebufferObject.h.