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" 205 void Bind(
unsigned int mode);
211 void UnBind(
unsigned int mode);
217 void SaveCurrentBindings();
218 void SaveCurrentBindings(
unsigned int mode);
220 this->SaveCurrentBuffers();
221 this->SaveCurrentBindings();
224 this->SaveCurrentBuffers(
mode);
225 this->SaveCurrentBindings(
mode);
227 void RestorePreviousBindings();
228 void RestorePreviousBindings(
unsigned int mode);
230 this->RestorePreviousBindings();
231 this->RestorePreviousBuffers();
234 this->RestorePreviousBindings(
mode);
235 this->RestorePreviousBuffers(
mode);
247 void SaveCurrentBuffers();
248 void SaveCurrentBuffers(
unsigned int mode);
249 void RestorePreviousBuffers();
250 void RestorePreviousBuffers(
unsigned int mode);
263 bool Start(
int width,
int height);
264 bool StartNonOrtho(
int width,
int height);
274 void InitializeViewport(
int width,
int height);
278 void ActivateDrawBuffers(
unsigned int n);
279 void ActivateDrawBuffers(
unsigned int *ids,
int n);
280 void ActivateDrawBuffer(
unsigned int id);
281 void ActivateReadBuffer(
unsigned int id);
283 this->ActivateDrawBuffer(
id);
284 this->ActivateReadBuffer(
id); }
285 void DeactivateDrawBuffers();
286 void DeactivateReadBuffer();
299 void RenderQuad(
int minX,
int maxX,
int minY,
int maxY,
308 void AddColorAttachment(
312 unsigned int zslice = 0);
313 void AddColorAttachment(
317 void RemoveColorAttachment(
unsigned int mode,
unsigned int index);
318 void RemoveColorAttachments(
unsigned int mode,
unsigned int num);
324 int GetNumberOfColorAttachments(
unsigned int mode);
331 this->AddDepthAttachment(this->GetBothMode()); }
332 void AddDepthAttachment(
unsigned int mode);
335 void RemoveDepthAttachment(
unsigned int mode);
344 bool PopulateFramebuffer(
int width,
int height);
345 bool PopulateFramebuffer(
349 int numberOfColorAttachments,
351 bool wantDepthAttachment,
361 unsigned int GetMaximumNumberOfActiveTargets();
368 unsigned int GetMaximumNumberOfRenderTargets();
376 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): returning LastSize pointer " << this->LastSize);
377 return this->LastSize;
381 _arg1 = this->LastSize[0];
382 _arg2 = this->LastSize[1];
383 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): returning LastSize (" << _arg1 <<
"," << _arg2 <<
")");
402 int CheckFrameBufferStatus(
unsigned int mode);
407 virtual void ReleaseGraphicsResources(
vtkWindow *win);
416 bool GetFrameBufferStatus(
427 const int srcExt[4],
const int destExt[4],
unsigned int bits,
unsigned int mapping);
485 static unsigned int GetDrawMode();
486 static unsigned int GetReadMode();
487 static unsigned int GetBothMode();
492 void Resize(
int width,
int height);
496 { this->RemoveColorAttachments(
mode, num); }
498 { this->RemoveColorAttachment(
mode, attId); }
500 { this->RemoveDepthAttachment(
mode); }
502 { this->RemoveDepthAttachment(
mode); }
505 void SetColorBuffer(
unsigned int mode,
507 unsigned int zslice=0);
508 void SetColorBuffer(
unsigned int mode,
521 void AttachColorBuffer(
unsigned int mode,
unsigned int index);
522 void AttachDepthBuffer(
unsigned int mode);
541 void DestroyColorBuffers(
vtkWindow *win);
544 void ActivateBuffers();
552 void DisplayFrameBufferAttachments();
557 void DisplayFrameBufferAttachment(
unsigned int uattachment);
562 void DisplayDrawBuffers();
567 void DisplayReadBuffer();
572 void DisplayBuffer(
int value);
577 int GetOpenGLType(
int vtkType);
584 unsigned int FBOIndex;
586 unsigned int PreviousDrawFBO;
587 unsigned int PreviousReadFBO;
588 bool DrawBindingSaved;
589 bool ReadBindingSaved;
590 unsigned int PreviousDrawBuffer;
591 unsigned int PreviousReadBuffer;
592 bool DrawBufferSaved;
593 bool ReadBufferSaved;
598 vtkFOInfo *DrawDepthBuffer;
599 vtkFOInfo *ReadDepthBuffer;
600 std::map<
unsigned int, vtkFOInfo *> DrawColorBuffers;
601 std::map<
unsigned int, vtkFOInfo *> ReadColorBuffers;
static bool IsSupported(vtkOpenGLRenderWindow *)
Returns if the context supports the required extensions.
void AddDepthAttachment()
Directly assign/remove a texture/renderbuffer to depth attachments.
virtual int * GetLastSize()=0
Dimensions in pixels of the framebuffer.
void RemoveRenDepthAttachment(unsigned int mode)
void RemoveTexColorAttachment(unsigned int mode, unsigned int attId)
static bool LoadRequiredExtensions(vtkOpenGLRenderWindow *)
Load all necessary extensions.
void GetLastSize(int &_arg1, int &_arg2) override
Dimensions in pixels of the framebuffer.
void SaveCurrentBindingsAndBuffers(unsigned int mode)
Store/Restore the current framebuffer bindings and buffers.
window superclass for vtkRenderWindow
void RemoveTexDepthAttachment(unsigned int mode)
abstract interface to OpenGL FBOs
const char * GetClassName() const
Return the class name as a string.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
void RestorePreviousBindingsAndBuffers()
Store/Restore the current framebuffer bindings and buffers.
The VertexArrayObject class uses, or emulates, vertex array objects.
a weak reference to a vtkObject.
void RestorePreviousBindingsAndBuffers(unsigned int mode)
Store/Restore the current framebuffer bindings and buffers.
abstracts an OpenGL pixel buffer object.
Internal class which encapsulates OpenGL FramebufferObject.
void GetLastSize(int _arg[2]) override
Dimensions in pixels of the framebuffer.
abstracts an OpenGL texture object.
create a window for renderers to draw into
void RemoveTexColorAttachments(unsigned int mode, unsigned int num)
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void SaveCurrentBindingsAndBuffers()
Store/Restore the current framebuffer bindings and buffers.
void ActivateBuffer(unsigned int id)
int * GetLastSize() override
Dimensions in pixels of the framebuffer.
The ShaderProgram uses one or more Shader objects.