VTK
dox
Rendering
OpenGL2
vtkFrameBufferObject2.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkFrameBufferObject2.h
5
6
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7
All rights reserved.
8
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10
This software is distributed WITHOUT ANY WARRANTY; without even
11
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
PURPOSE. See the above copyright notice for more information.
13
14
=========================================================================*/
45
#ifndef vtkFrameBufferObject2_h
46
#define vtkFrameBufferObject2_h
47
48
#include "
vtkFrameBufferObjectBase.h
"
49
#include "vtkRenderingOpenGL2Module.h"
// For export macro
50
#include "
vtkSmartPointer.h
"
// needed for vtkSmartPointer.
51
#include "
vtkWeakPointer.h
"
// needed for vtkWeakPointer.
52
59
#ifdef NDEBUG
60
# define vtkCheckFrameBufferStatusMacro(mode)
61
# define vtkStaticCheckFrameBufferStatusMacro(mode)
62
#else
63
# define vtkCheckFrameBufferStatusMacroImpl(macro, mode) \
64
{ \
65
const char *eStr; \
66
bool ok = vtkFrameBufferObject2::GetFrameBufferStatus(mode, eStr); \
67
if (!ok) \
68
{ \
69
macro( \
70
<< "OpenGL ERROR. The FBO is incomplete : " << eStr); \
71
} \
72
}
73
# define vtkCheckFrameBufferStatusMacro(mode) \
74
vtkCheckFrameBufferStatusMacroImpl(vtkErrorMacro, mode)
75
# define vtkStaticCheckFrameBufferStatusMacro(mode) \
76
vtkCheckFrameBufferStatusMacroImpl(vtkGenericWarningMacro, mode)
77
#endif
78
79
class
vtkRenderWindow
;
80
class
vtkTextureObject
;
81
class
vtkRenderbuffer
;
82
class
vtkPixelBufferObject
;
83
class
vtkOpenGLRenderWindow
;
84
85
class
VTKRENDERINGOPENGL2_EXPORT
vtkFrameBufferObject2
:
public
vtkFrameBufferObjectBase
86
{
87
public
:
88
static
vtkFrameBufferObject2
*
New
();
89
vtkTypeMacro(
vtkFrameBufferObject2
,
vtkFrameBufferObjectBase
);
90
void
PrintSelf
(ostream& os,
vtkIndent
indent);
91
93
100
void
SetContext(
vtkRenderWindow
*context);
101
vtkRenderWindow
*GetContext();
103
108
static
bool
IsSupported(
vtkRenderWindow
*renWin);
109
116
void
Bind(
unsigned
int
mode
);
117
123
void
UnBind(
unsigned
int
mode
);
124
132
void
SaveCurrentBindings();
133
135
142
void
SaveCurrentBuffers();
143
void
RestorePreviousBuffers(
unsigned
int
mode
);
145
149
void
AddColorAttachment(
150
unsigned
int
mode
,
151
unsigned
int
attId,
152
vtkTextureObject
* tex);
153
154
void
AddTexColorAttachment(
155
unsigned
int
mode
,
156
unsigned
int
attId,
157
unsigned
int
handle);
158
159
void
RemoveTexColorAttachments(
unsigned
int
mode
,
unsigned
int
num);
160
void
RemoveTexColorAttachment
(
unsigned
int
mode
,
unsigned
int
attId)
161
{ this->AddTexColorAttachment(
mode
, attId, 0U); }
162
166
void
AddColorAttachment(
167
unsigned
int
mode
,
168
unsigned
int
attId,
169
vtkRenderbuffer
* tex);
170
171
void
AddRenColorAttachment(
172
unsigned
int
mode
,
173
unsigned
int
attId,
174
unsigned
int
handle);
175
176
void
RemoveRenColorAttachments(
unsigned
int
mode
,
unsigned
int
num);
177
void
RemoveRenColorAttachment
(
unsigned
int
mode
,
unsigned
int
attId)
178
{ this->AddRenColorAttachment(
mode
, attId, 0U); }
179
181
184
void
AddDepthAttachment(
unsigned
int
mode
,
vtkTextureObject
* tex);
185
void
AddTexDepthAttachment(
unsigned
int
mode
,
unsigned
int
handle);
186
void
RemoveTexDepthAttachment
(
unsigned
int
mode
)
187
{ this->AddTexDepthAttachment(
mode
, 0U); }
189
191
194
void
AddDepthAttachment(
unsigned
int
mode
,
vtkRenderbuffer
* tex);
195
void
AddRenDepthAttachment(
unsigned
int
mode
,
unsigned
int
handle);
196
void
RemoveRenDepthAttachment
(
unsigned
int
mode
)
197
{ this->AddRenDepthAttachment(
mode
, 0U); }
199
201
204
void
ActivateDrawBuffer(
unsigned
int
id
);
205
void
ActivateReadBuffer(
unsigned
int
id
);
206
void
DeactivateReadBuffer();
208
210
214
void
ActivateDrawBuffers(
unsigned
int
n);
215
void
ActivateDrawBuffers(
unsigned
int
*ids,
int
n);
216
void
DeactivateDrawBuffers();
218
225
static
226
void
InitializeViewport(
int
width,
int
height
);
227
233
int
CheckFrameBufferStatus(
unsigned
int
mode
);
234
241
static
242
bool
GetFrameBufferStatus(
243
unsigned
int
mode
,
244
const
char
*&desc);
245
252
static
253
int
Blit(
254
int
srcExt[4],
255
int
destExt[4],
256
unsigned
int
bits,
257
unsigned
int
mapping);
258
267
vtkPixelBufferObject
*DownloadColor1(
268
int
extent
[4],
269
int
vtkType,
270
int
channel);
271
272
vtkPixelBufferObject
*DownloadColor3(
273
int
extent
[4],
274
int
vtkType);
275
276
vtkPixelBufferObject
*DownloadColor4(
277
int
extent
[4],
278
int
vtkType);
279
285
vtkPixelBufferObject
*DownloadDepth(
286
int
extent
[4],
287
int
vtkType);
288
296
vtkPixelBufferObject
*Download(
297
int
extent
[4],
298
int
vtkType,
299
int
nComps,
300
int
oglType,
301
int
oglFormat);
302
303
static
304
void
Download(
305
int
extent
[4],
306
int
vtkType,
307
int
nComps,
308
int
oglType,
309
int
oglFormat,
310
vtkPixelBufferObject
*pbo);
311
313
320
virtual
int
*
GetLastSize
();
321
virtual
void
GetLastSize
(
int
&width,
int
&
height
);
322
virtual
void
GetLastSize
(
int
size
[2]);
324
331
int
*
GetLastSize
(
bool
forceUpdate);
332
333
protected
:
337
static
338
bool
LoadRequiredExtensions(
vtkRenderWindow
*renWin);
339
340
// gen buffer (occurs when context is set)
341
void
CreateFBO();
342
343
// delete buffer (occurs during destruction or context swicth)
344
void
DestroyFBO();
345
349
int
GetOpenGLType(
int
vtkType);
350
351
vtkFrameBufferObject2
();
352
~
vtkFrameBufferObject2
();
353
354
vtkWeakPointer<vtkRenderWindow>
Context;
355
356
unsigned
int
FBOIndex;
357
unsigned
int
PreviousDrawFBO;
358
unsigned
int
PreviousReadFBO;
359
unsigned
int
PreviousDrawBuffer;
360
unsigned
int
PreviousReadBuffer;
361
int
LastViewportSize[2];
362
363
private
:
367
inline
void
QueryViewportSize();
368
369
vtkFrameBufferObject2
(
const
vtkFrameBufferObject2
&) VTK_DELETE_FUNCTION;
370
void
operator=(
const
vtkFrameBufferObject2
&) VTK_DELETE_FUNCTION;
371
372
friend
class
vtkRenderbuffer
;
// needs access to LoadRequiredExtentsions
373
374
};
375
376
#endif
vtkFrameBufferObject2::RemoveTexDepthAttachment
void RemoveTexDepthAttachment(unsigned int mode)
Definition:
vtkFrameBufferObject2.h:186
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkFrameBufferObject2::RemoveRenDepthAttachment
void RemoveRenDepthAttachment(unsigned int mode)
Definition:
vtkFrameBufferObject2.h:196
vtkFrameBufferObjectBase::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkFrameBufferObjectBase
abstract interface to OpenGL FBOs
Definition:
vtkFrameBufferObjectBase.h:32
vtkFrameBufferObject2::RemoveRenColorAttachment
void RemoveRenColorAttachment(unsigned int mode, unsigned int attId)
Definition:
vtkFrameBufferObject2.h:177
vtkX3D::height
Definition:
vtkX3D.h:254
vtkIndent
a simple class to control print indentation
Definition:
vtkIndent.h:39
vtkTextureObject
abstracts an OpenGL texture object.
Definition:
vtkTextureObject.h:40
vtkSmartPointer.h
vtkX3D::size
Definition:
vtkX3D.h:253
vtkWeakPointer.h
vtkFrameBufferObjectBase.h
vtkFrameBufferObject2::RemoveTexColorAttachment
void RemoveTexColorAttachment(unsigned int mode, unsigned int attId)
Definition:
vtkFrameBufferObject2.h:160
vtkX3D::mode
Definition:
vtkX3D.h:247
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition:
vtkOpenGLRenderWindow.h:38
vtkX3D::extent
Definition:
vtkX3D.h:345
vtkRenderWindow
create a window for renderers to draw into
Definition:
vtkRenderWindow.h:86
vtkFrameBufferObject2
Interface to OpenGL framebuffer object.
Definition:
vtkFrameBufferObject2.h:86
vtkFrameBufferObjectBase::GetLastSize
virtual int * GetLastSize()=0
Dimensions in pixels of the framebuffer.
vtkPixelBufferObject
abstracts an OpenGL pixel buffer object.
Definition:
vtkPixelBufferObject.h:43
vtkWeakPointer< vtkRenderWindow >
vtkRenderbuffer
Storage for FBO's.
Definition:
vtkRenderbuffer.h:32
Generated by
1.8.16