120#ifndef vtkOpenGLFramebufferObject_h
121#define vtkOpenGLFramebufferObject_h
130#define VTK_UPDATED_FRAMEBUFFER
139#define vtkCheckFrameBufferStatusMacro(mode)
140#define vtkStaticCheckFrameBufferStatusMacro(mode)
142#define vtkCheckFrameBufferStatusMacroImpl(macro, mode) \
145 bool ok = vtkOpenGLFramebufferObject::GetFrameBufferStatus(mode, eStr); \
148 macro(<< "OpenGL ERROR. The FBO is incomplete : " << eStr); \
151#define vtkCheckFrameBufferStatusMacro(mode) vtkCheckFrameBufferStatusMacroImpl(vtkErrorMacro, mode)
152#define vtkStaticCheckFrameBufferStatusMacro(mode) \
153 vtkCheckFrameBufferStatusMacroImpl(vtkGenericWarningMacro, mode)
157#include "vtkRenderingOpenGL2Module.h"
161VTK_ABI_NAMESPACE_BEGIN
242 this->ActivateDrawBuffer(
id);
243 this->ActivateReadBuffer(
id);
249 vtkGetMacro(ActiveReadBuffer,
unsigned int);
270 unsigned int format = 0,
unsigned int mipmapLevel = 0);
306 int colorDataType,
bool wantDepthAttachment,
int depthBitplanes,
int multisamples,
307 bool wantStencilAttachment =
false);
330 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): returning LastSize pointer "
332 return this->LastSize;
336 _arg1 = this->LastSize[0];
337 _arg2 = this->LastSize[1];
338 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): returning LastSize (" << _arg1
339 <<
"," << _arg2 <<
")");
369 vtkGetMacro(FBOIndex,
unsigned int);
378 const int srcExt[4],
const int destExt[4],
unsigned int bits,
unsigned int mapping);
409 int extent[4],
int vtkType,
int nComps,
int oglType,
int oglFormat);
abstract interface to OpenGL FBOs
a simple class to control print indentation
const char * GetClassName() const
Return the class name as a string.
Internal class which encapsulates OpenGL FramebufferObject.
void DeactivateReadBuffer()
void Bind()
Make the draw frame buffer active.
void ActivateDrawBuffer(unsigned int id)
~vtkOpenGLFramebufferObject() override
std::vector< unsigned int > ActiveBuffers
void SaveCurrentBindingsAndBuffers(unsigned int mode)
Store/Restore the current framebuffer bindings and buffers.
void AttachColorBuffer(unsigned int index)
Attach a specific buffer.
void DeactivateDrawBuffers()
static bool IsSupported(vtkOpenGLRenderWindow *)
Returns if the context supports the required extensions.
vtkPixelBufferObject * DownloadColor4(int extent[4], int vtkType)
void ActivateDrawBuffers(unsigned int *ids, int n)
void UnBind()
Unbind this buffer.
void InitializeViewport(int width, int height)
Set up ortho viewport with scissor, lighting, blend, and depth disabled.
void RestorePreviousBindingsAndBuffers(unsigned int mode)
Store/Restore the current framebuffer bindings and buffers.
void UnBind(unsigned int mode)
void GetLastSize(int &_arg1, int &_arg2) override
Dimensions in pixels of the framebuffer.
static void Download(int extent[4], int vtkType, int nComps, int oglType, int oglFormat, vtkPixelBufferObject *pbo)
void RemoveColorAttachment(unsigned int index)
Directly assign/remove a texture to color attachments.
int * GetLastSize() override
Dimensions in pixels of the framebuffer.
void Bind(unsigned int mode)
void DisplayFrameBufferAttachment(unsigned int uattachment)
Display a given attachment for the current framebuffer object.
void AddDepthAttachment(vtkTextureObject *tex)
Directly assign/remove a texture/renderbuffer to depth attachments.
void RemoveColorAttachments(unsigned int num)
Directly assign/remove a texture to color attachments.
bool StartNonOrtho(int width, int height)
User must take care that width/height match the dimensions of the user defined texture attachments.
vtkPixelBufferObject * DownloadDepth(int extent[4], int vtkType)
Download data from the depth attachment of the currently bound FBO.
void DisplayDrawBuffers()
Display the draw buffers.
vtkTextureObject * GetDepthAttachmentAsTextureObject()
Directly assign/remove a texture/renderbuffer to depth attachments.
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 DestroyDepthBuffer(vtkWindow *win)
bool PopulateFramebuffer(int width, int height)
Convenience method to populate a framebuffer with attachments created as well.
void GetLastSize(int _arg[2]) override
Dimensions in pixels of the framebuffer.
static unsigned int GetBothMode()
int CheckFrameBufferStatus(unsigned int mode)
Validate the current FBO configuration (attachments, formats, etc) prints detected errors to vtkError...
void DisplayFrameBufferAttachments()
Display all the attachments of the current framebuffer object.
void DisplayReadBuffer()
Display the read buffer.
void ActivateBuffer(unsigned int id)
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
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.
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 bool LoadRequiredExtensions(vtkOpenGLRenderWindow *)
Load all necessary extensions.
vtkTextureObject * GetColorAttachmentAsTextureObject(unsigned int num)
Return the texture object bound to the passed attachment number.
int GetOpenGLType(int vtkType)
Given a vtk type get a compatible open gl type.
void Resize(int width, int height)
Resize all FO attachments.
bool Start(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)
static unsigned int GetDrawMode()
unsigned int GetActiveDrawBuffer(unsigned int id)
vtkOpenGLFramebufferObject()
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 PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void AddDepthAttachment()
Directly assign/remove a texture/renderbuffer to depth attachments.
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 ActiveReadBuffer
virtual void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind.
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.
std::map< unsigned int, vtkFOInfo * > ColorBuffers
void DestroyColorBuffers(vtkWindow *win)
int GetNumberOfColorAttachments()
Return the number of color attachments for the given mode.
void DisplayBuffer(int value)
Display any buffer (convert value into string).
unsigned int GetMaximumNumberOfRenderTargets()
Returns the maximum number of render targets available.
void SaveCurrentBindingsAndBuffers()
Store/Restore the current framebuffer bindings and buffers.
vtkOpenGLRenderWindow * Context
void AddColorAttachment(unsigned int attId, vtkRenderbuffer *tex)
Directly assign/remove a texture to color attachments.
void AddDepthAttachment(vtkRenderbuffer *tex)
Directly assign/remove a texture/renderbuffer to depth attachments.
vtkPixelBufferObject * DownloadColor3(int extent[4], int vtkType)
void RemoveDepthAttachment()
Directly assign/remove a texture/renderbuffer to depth attachments.
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.
unsigned int GetMaximumNumberOfActiveTargets()
Returns the maximum number of targets that can be rendered to at one time.
void SetContext(vtkRenderWindow *context)
Get/Set the context.
void ActivateReadBuffer(unsigned int id)
void RestorePreviousBindingsAndBuffers()
Store/Restore the current framebuffer bindings and buffers.
vtkOpenGLRenderWindow * GetContext()
Get/Set the context.
static unsigned int GetReadMode()
The VertexArrayObject class uses, or emulates, vertex array objects.
abstracts an OpenGL pixel buffer object.
create a window for renderers to draw into
The ShaderProgram uses one or more Shader objects.
abstracts an OpenGL texture object.
window superclass for vtkRenderWindow