|
virtual vtkTypeBool | IsA (const char *type) |
| Return 1 if this class is the same type of (or a subclass of) the named class.
|
|
vtkOpenGLFramebufferObject * | NewInstance () const |
|
void | PrintSelf (ostream &os, vtkIndent indent) override |
| Methods invoked by print to print information about the object including superclasses.
|
|
void | Bind () |
| Make the draw frame buffer active.
|
|
void | Bind (unsigned int mode) |
|
void | UnBind () |
| Unbind this buffer.
|
|
void | UnBind (unsigned int mode) |
|
void | InitializeViewport (int width, int height) |
| Set up ortho viewport with scissor, lighting, blend, and depth disabled.
|
|
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.
|
|
vtkTextureObject * | GetColorAttachmentAsTextureObject (unsigned int num) |
| Return the texture object bound to the passed attachment number.
|
|
int | GetNumberOfColorAttachments () |
| Return the number of color attachments for the given mode.
|
|
unsigned int | GetMaximumNumberOfActiveTargets () |
| Returns the maximum number of targets that can be rendered to at one time.
|
|
unsigned int | GetMaximumNumberOfRenderTargets () |
| Returns the maximum number of render targets available.
|
|
int | CheckFrameBufferStatus (unsigned int mode) |
| Validate the current FBO configuration (attachments, formats, etc) prints detected errors to vtkErrorMacro.
|
|
virtual void | ReleaseGraphicsResources (vtkWindow *win) |
| Deactivate and UnBind.
|
|
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.
|
|
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.
|
|
vtkPixelBufferObject * | Download (int extent[4], int vtkType, int nComps, int oglType, int oglFormat) |
| Download data from the read buffer of the current FBO.
|
|
void | Resize (int width, int height) |
| Resize all FO attachments.
|
|
int | GetMultiSamples () |
|
|
void | SetContext (vtkRenderWindow *context) |
| Get/Set the context.
|
|
vtkOpenGLRenderWindow * | GetContext () |
| Get/Set the context.
|
|
|
void | SaveCurrentBindingsAndBuffers () |
| Store/Restore the current framebuffer bindings and buffers.
|
|
void | SaveCurrentBindingsAndBuffers (unsigned int mode) |
| Store/Restore the current framebuffer bindings and buffers.
|
|
void | RestorePreviousBindingsAndBuffers () |
| Store/Restore the current framebuffer bindings and buffers.
|
|
void | RestorePreviousBindingsAndBuffers (unsigned int mode) |
| Store/Restore the current framebuffer bindings and buffers.
|
|
|
bool | Start (int width, int height) |
| User must take care that width/height match the dimensions of the user defined texture attachments.
|
|
bool | StartNonOrtho (int width, int height) |
| User must take care that width/height match the dimensions of the user defined texture attachments.
|
|
|
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.
|
|
void | AddColorAttachment (unsigned int attId, vtkRenderbuffer *tex) |
| Directly assign/remove a texture to color attachments.
|
|
void | RemoveColorAttachment (unsigned int index) |
| Directly assign/remove a texture to color attachments.
|
|
void | RemoveColorAttachments (unsigned int num) |
| Directly assign/remove a texture to color attachments.
|
|
|
void | AddDepthAttachment () |
| Directly assign/remove a texture/renderbuffer to depth attachments.
|
|
void | AddDepthAttachment (vtkTextureObject *tex) |
| Directly assign/remove a texture/renderbuffer to depth attachments.
|
|
void | AddDepthAttachment (vtkRenderbuffer *tex) |
| Directly assign/remove a texture/renderbuffer to depth attachments.
|
|
void | RemoveDepthAttachment () |
| Directly assign/remove a texture/renderbuffer to depth attachments.
|
|
vtkTextureObject * | GetDepthAttachmentAsTextureObject () |
| Directly assign/remove a texture/renderbuffer to depth attachments.
|
|
|
bool | PopulateFramebuffer (int width, int height) |
| Convenience method to populate a framebuffer with attachments created as well.
|
|
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.
|
|
|
int * | GetLastSize () override |
| Dimensions in pixels of the framebuffer.
|
|
void | GetLastSize (int &_arg1, int &_arg2) override |
| Dimensions in pixels of the framebuffer.
|
|
void | GetLastSize (int _arg[2]) override |
| Dimensions in pixels of the framebuffer.
|
|
virtual vtkTypeBool | IsA (const char *type) |
| Return 1 if this class is the same type of (or a subclass of) the named class.
|
|
vtkFrameBufferObjectBase * | NewInstance () const |
|
void | PrintSelf (ostream &os, vtkIndent indent) override |
| Methods invoked by print to print information about the object including superclasses.
|
|
| vtkBaseTypeMacro (vtkObject, vtkObjectBase) |
|
virtual void | DebugOn () |
| Turn debugging output on.
|
|
virtual void | DebugOff () |
| Turn debugging output off.
|
|
bool | GetDebug () |
| Get the value of the debug flag.
|
|
void | SetDebug (bool debugFlag) |
| Set the value of the debug flag.
|
|
virtual void | Modified () |
| Update the modification time for this object.
|
|
virtual vtkMTimeType | GetMTime () |
| Return this object's modified time.
|
|
void | PrintSelf (ostream &os, vtkIndent indent) override |
| Methods invoked by print to print information about the object including superclasses.
|
|
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.
|
|
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object.
|
|
vtkCommand * | GetCommand (unsigned long tag) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object.
|
|
void | RemoveObserver (vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object.
|
|
void | RemoveObservers (unsigned long event, vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object.
|
|
void | RemoveObservers (const char *event, vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object.
|
|
vtkTypeBool | HasObserver (unsigned long event, vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object.
|
|
vtkTypeBool | HasObserver (const char *event, vtkCommand *) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object.
|
|
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.
|
|
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.
|
|
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.
|
|
int | InvokeEvent (unsigned long event, void *callData) |
| This method invokes an event and return whether the event was aborted or not.
|
|
int | InvokeEvent (const char *event, void *callData) |
| This method invokes an event and return whether the event was aborted or not.
|
|
const char * | GetClassName () const |
| Return the class name as a string.
|
|
virtual vtkTypeBool | IsA (const char *name) |
| Return 1 if this class is the same type of (or a subclass of) the named class.
|
|
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).
|
|
virtual void | Delete () |
| Delete a VTK object.
|
|
virtual void | FastDelete () |
| Delete a reference to this object.
|
|
void | InitializeObjectBase () |
|
void | Print (ostream &os) |
| Print an object to an ostream.
|
|
virtual void | Register (vtkObjectBase *o) |
| Increase the reference count (mark as used by another object).
|
|
virtual void | UnRegister (vtkObjectBase *o) |
| Decrease the reference count (release by another object).
|
|
int | GetReferenceCount () |
| Return the current reference count of this object.
|
|
void | SetReferenceCount (int) |
| Sets the reference count.
|
|
bool | GetIsInMemkind () const |
| A local state flag that remembers whether this object lives in the normal or extended memory space.
|
|
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
| Methods invoked by print to print information about the object including superclasses.
|
|
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
| Methods invoked by print to print information about the object including superclasses.
|
|
|
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.
|
|
static bool | GetFrameBufferStatus (unsigned int mode, const char *&desc) |
| Validate the current FBO configuration (attachments, formats, etc) return false if the FBO is incomplete.
|
|
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.
|
|
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.
|
|
static void | BreakOnError () |
| This method is called when vtkErrorMacro executes.
|
|
static void | SetGlobalWarningDisplay (int val) |
| This is a global flag that controls whether any debug, warning or error messages are displayed.
|
|
static void | GlobalWarningDisplayOn () |
| This is a global flag that controls whether any debug, warning or error messages are displayed.
|
|
static void | GlobalWarningDisplayOff () |
| This is a global flag that controls whether any debug, warning or error messages are displayed.
|
|
static int | GetGlobalWarningDisplay () |
| This is a global flag that controls whether any debug, warning or error messages are displayed.
|
|
static vtkTypeBool | IsTypeOf (const char *name) |
| Return 1 if this class type is the same type of (or a subclass of) the named class.
|
|
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).
|
|
static vtkObjectBase * | New () |
| Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
|
|
static void | SetMemkindDirectory (const char *directoryname) |
| The name of a directory, ideally mounted -o dax, to memory map an extended memory space within.
|
|
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.
|
|
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.