Go to the documentation of this file.
135 #ifndef vtkOpenGLFramebufferObject_h
136 #define vtkOpenGLFramebufferObject_h
145 # define vtkCheckFrameBufferStatusMacro(mode)
146 # define vtkStaticCheckFrameBufferStatusMacro(mode)
148 # define vtkCheckFrameBufferStatusMacroImpl(macro, mode) \
151 bool ok = vtkOpenGLFramebufferObject::GetFrameBufferStatus(mode, eStr); \
155 << "OpenGL ERROR. The FBO is incomplete : " << eStr); \
158 # define vtkCheckFrameBufferStatusMacro(mode) \
159 vtkCheckFrameBufferStatusMacroImpl(vtkErrorMacro, mode)
160 # define vtkStaticCheckFrameBufferStatusMacro(mode) \
161 vtkCheckFrameBufferStatusMacroImpl(vtkGenericWarningMacro, mode)
166 #include "vtkRenderingOpenGL2Module.h"
220 this->SaveCurrentBuffers();
221 this->SaveCurrentBindings();
224 this->SaveCurrentBuffers(
mode);
225 this->SaveCurrentBindings(
mode);
230 this->RestorePreviousBindings();
231 this->RestorePreviousBuffers();
234 this->RestorePreviousBindings(
mode);
235 this->RestorePreviousBuffers(
mode);
280 this->ActivateDrawBuffer(
id);
281 this->ActivateReadBuffer(
id); }
309 unsigned int zslice = 0,
310 unsigned int format = 0,
311 unsigned int mipmapLevel = 0);
330 this->AddDepthAttachment(this->GetBothMode()); }
348 int numberOfColorAttachments,
350 bool wantDepthAttachment,
375 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): returning LastSize pointer " << this->LastSize);
376 return this->LastSize;
380 _arg1 = this->LastSize[0];
381 _arg2 = this->LastSize[1];
382 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): returning LastSize (" << _arg1 <<
"," << _arg2 <<
")");
426 const int srcExt[4],
const int destExt[4],
unsigned int bits,
unsigned int mapping);
495 { this->RemoveColorAttachments(
mode, num); }
497 { this->RemoveColorAttachment(
mode, attId); }
499 { this->RemoveDepthAttachment(
mode); }
501 { this->RemoveDepthAttachment(
mode); }
506 unsigned int zslice=0,
unsigned int format=0,
unsigned int mipmapLevel=0);
int * GetLastSize() override
Dimensions in pixels of the framebuffer.
static unsigned int GetDrawMode()
void DisplayReadBuffer()
Display the read buffer.
void UnBind(unsigned int mode)
void AddDepthAttachment(unsigned int mode, vtkTextureObject *tex)
void SaveCurrentBindingsAndBuffers(unsigned int mode)
void DeactivateDrawBuffers()
bool PopulateFramebuffer(int width, int height, bool useTextures, int numberOfColorAttachments, int colorDataType, bool wantDepthAttachment, int depthBitplanes, int multisamples)
void RestorePreviousBindingsAndBuffers()
bool StartNonOrtho(int width, int height)
void SaveCurrentBindings(unsigned int mode)
int GetNumberOfColorAttachments(unsigned int mode)
Return the number of color attachments for the given mode.
vtkOpenGLFramebufferObject()
unsigned int PreviousReadBuffer
bool PopulateFramebuffer(int width, int height)
Convenience method to populate a framebuffer with attachments created as well.
void SetDepthBuffer(unsigned int mode, vtkTextureObject *depthTexture)
Internal class which encapsulates OpenGL FramebufferObject.
unsigned int GetMaximumNumberOfRenderTargets()
Returns the maximum number of render targets available.
void SetDepthBuffer(unsigned int mode, vtkRenderbuffer *depthBuffer)
void GetLastSize(int _arg[2]) override
void RemoveTexDepthAttachment(unsigned int mode)
unsigned int PreviousDrawBuffer
void RestorePreviousBuffers()
void ActivateReadBuffer(unsigned int id)
vtkWeakPointer< vtkOpenGLRenderWindow > Context
void RemoveDepthAttachment(unsigned int mode)
vtkPixelBufferObject * DownloadColor3(int extent[4], int vtkType)
void DisplayDrawBuffers()
Display the draw buffers.
vtkPixelBufferObject * DownloadDepth(int extent[4], int vtkType)
Download data from the depth attachment of the currently bound FBO.
void RemoveColorAttachment(unsigned int mode, unsigned int index)
static bool LoadRequiredExtensions(vtkOpenGLRenderWindow *)
Load all necessary extensions.
vtkPixelBufferObject * DownloadColor4(int extent[4], int vtkType)
abstract interface to OpenGL FBOs
window superclass for vtkRenderWindow
void ActivateDrawBuffers(unsigned int n)
bool Start(int width, int height)
User must take care that width/height match the dimensions of the user defined texture attachments.
vtkOpenGLRenderWindow * GetContext()
void DisplayBuffer(int value)
Display any buffer (convert value into string).
void ActivateDrawBuffers(unsigned int *ids, int n)
void Attach()
Attach all buffers to the FO if not already done so.
void SaveCurrentBuffers(unsigned int mode)
const char * GetClassName() const
Return the class name as a string.
vtkPixelBufferObject * Download(int extent[4], int vtkType, int nComps, int oglType, int oglFormat)
Download data from the read buffer of the current FBO.
static vtkOpenGLFramebufferObject * New()
unsigned int PreviousDrawFBO
int CheckFrameBufferStatus(unsigned int mode)
Validate the current FBO configuration (attachments, formats, etc) prints detected errors to vtkError...
std::map< unsigned int, vtkFOInfo * > DrawColorBuffers
void AttachColorBuffer(unsigned int mode, unsigned int index)
Attach a specific buffer.
void RemoveColorAttachments(unsigned int mode, unsigned int num)
std::map< unsigned int, vtkFOInfo * > ReadColorBuffers
void InitializeViewport(int width, int height)
Set up ortho viewport with scissor, lighting, blend, and depth disabled.
The ShaderProgram uses one or more Shader objects.
void Resize(int width, int height)
Resize all FO attachments.
void RemoveTexColorAttachments(unsigned int mode, unsigned int num)
void DestroyDepthBuffer(vtkWindow *win)
a simple class to control print indentation
abstracts an OpenGL texture object.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static bool IsSupported(vtkOpenGLRenderWindow *)
Returns if the context supports the required extensions.
void Bind()
Make the draw frame buffer active.
void RemoveRenDepthAttachment(unsigned int mode)
void DeactivateReadBuffer()
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
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.
void RestorePreviousBindings()
void AddDepthAttachment(unsigned int mode, vtkRenderbuffer *tex)
int GetOpenGLType(int vtkType)
Given a vtk type get a compatible open gl type.
void AddDepthAttachment()
Directly assign/remove a texture/renderbuffer to depth attachments.
void DisplayFrameBufferAttachment(unsigned int uattachment)
Display a given attachment for the current framebuffer object.
void RenderQuad(int minX, int maxX, int minY, int maxY, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
Renders a quad at the given location with pixel coordinates.
void DestroyColorBuffers(vtkWindow *win)
unsigned int PreviousReadFBO
void SetContext(vtkRenderWindow *context)
Get/Set the context.
~vtkOpenGLFramebufferObject() override
static void Download(int extent[4], int vtkType, int nComps, int oglType, int oglFormat, vtkPixelBufferObject *pbo)
void Bind(unsigned int mode)
void SetColorBuffer(unsigned int mode, unsigned int index, vtkTextureObject *texture, unsigned int zslice=0, unsigned int format=0, unsigned int mipmapLevel=0)
void SaveCurrentBuffers()
Store the current draw and read buffers.
void RestorePreviousBindingsAndBuffers(unsigned int mode)
void AddDepthAttachment(unsigned int mode)
void RestorePreviousBindings(unsigned int mode)
vtkFOInfo * ReadDepthBuffer
void RemoveTexColorAttachment(unsigned int mode, unsigned int attId)
static unsigned int GetBothMode()
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.
virtual void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind.
create a window for renderers to draw into
void GetLastSize(int &_arg1, int &_arg2) override
void RestorePreviousBuffers(unsigned int mode)
std::vector< unsigned int > ActiveBuffers
vtkFOInfo * DrawDepthBuffer
static bool GetFrameBufferStatus(unsigned int mode, const char *&desc)
Validate the current FBO configuration (attachments, formats, etc) return false if the FBO is incompl...
void UnBind()
Unbind this buffer.
unsigned int GetMaximumNumberOfActiveTargets()
Returns the maximum number of targets that can be rendered to at one time.
void SaveCurrentBindingsAndBuffers()
void DisplayFrameBufferAttachments()
Display all the attachments of the current framebuffer object.
void AttachDepthBuffer(unsigned int mode)
The VertexArrayObject class uses, or emulates, vertex array objects.
void ActivateDrawBuffer(unsigned int id)
virtual int * GetLastSize()=0
Dimensions in pixels of the framebuffer.
static unsigned int GetReadMode()
abstracts an OpenGL pixel buffer object.
void SetColorBuffer(unsigned int mode, unsigned int index, vtkRenderbuffer *rb)
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.
void AddColorAttachment(unsigned int mode, unsigned int attId, vtkRenderbuffer *tex)
void ActivateBuffer(unsigned int id)
void SaveCurrentBindings()
Store/Restore the current framebuffer bindings and buffers.