VTK  9.2.6
vtkRenderWindow.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkRenderWindow.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=========================================================================*/
43
44#ifndef vtkRenderWindow_h
45#define vtkRenderWindow_h
46
47#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
48#include "vtkEventData.h" // for enums
49#include "vtkNew.h" // For vtkNew
50#include "vtkRenderingCoreModule.h" // For export macro
51#include "vtkSmartPointer.h" // For vtkSmartPointer
52#include "vtkWindow.h"
53
54class vtkFloatArray;
55class vtkProp;
56class vtkCollection;
57class vtkMatrix4x4;
60class vtkRenderer;
64
65// lets define the different types of stereo
66#define VTK_STEREO_CRYSTAL_EYES 1
67#define VTK_STEREO_RED_BLUE 2
68#define VTK_STEREO_INTERLACED 3
69#define VTK_STEREO_LEFT 4
70#define VTK_STEREO_RIGHT 5
71#define VTK_STEREO_DRESDEN 6
72#define VTK_STEREO_ANAGLYPH 7
73#define VTK_STEREO_CHECKERBOARD 8
74#define VTK_STEREO_SPLITVIEWPORT_HORIZONTAL 9
75#define VTK_STEREO_FAKE 10
76#define VTK_STEREO_EMULATE 11
77
78#define VTK_CURSOR_DEFAULT 0
79#define VTK_CURSOR_ARROW 1
80#define VTK_CURSOR_SIZENE 2
81#define VTK_CURSOR_SIZENW 3
82#define VTK_CURSOR_SIZESW 4
83#define VTK_CURSOR_SIZESE 5
84#define VTK_CURSOR_SIZENS 6
85#define VTK_CURSOR_SIZEWE 7
86#define VTK_CURSOR_SIZEALL 8
87#define VTK_CURSOR_HAND 9
88#define VTK_CURSOR_CROSSHAIR 10
89#define VTK_CURSOR_CUSTOM 11
90
91class VTKRENDERINGCORE_EXPORT vtkRenderWindow : public vtkWindow
92{
93public:
94 vtkTypeMacro(vtkRenderWindow, vtkWindow);
95 void PrintSelf(ostream& os, vtkIndent indent) override;
96
103
107 virtual void AddRenderer(vtkRenderer*);
108
113
118
122 static const char* GetRenderLibrary();
123
127 virtual const char* GetRenderingBackend();
128
133
138
147
149
152 vtkGetMacro(CapturingGL2PSSpecialProps, int);
154
159 void Render() override;
160
164 virtual void Start() {}
165
169 virtual void End(){};
170
174 virtual void Finalize() {}
175
180 virtual void Frame() {}
181
186 virtual void WaitForCompletion() {}
187
192 virtual void CopyResultFrame();
193
200
202
208 virtual void HideCursor() {}
209 virtual void ShowCursor() {}
210 virtual void SetCursorPosition(int, int) {}
212
214
217 vtkSetMacro(CurrentCursor, int);
218 vtkGetMacro(CurrentCursor, int);
220
222
229
231
234 virtual void SetFullScreen(vtkTypeBool) {}
235 vtkGetMacro(FullScreen, vtkTypeBool);
236 vtkBooleanMacro(FullScreen, vtkTypeBool);
238
240
245 vtkSetMacro(Borders, vtkTypeBool);
246 vtkGetMacro(Borders, vtkTypeBool);
247 vtkBooleanMacro(Borders, vtkTypeBool);
249
251
257 virtual void SetStereoCapableWindow(vtkTypeBool capable);
259
261
266 vtkBooleanMacro(StereoRender, vtkTypeBool);
268
270
275 vtkBooleanMacro(AlphaBitPlanes, vtkTypeBool);
277
279
285 vtkBooleanMacro(PointSmoothing, vtkTypeBool);
287
289
295 vtkBooleanMacro(LineSmoothing, vtkTypeBool);
297
299
305 vtkBooleanMacro(PolygonSmoothing, vtkTypeBool);
307
309
330 vtkGetMacro(StereoType, int);
331 void SetStereoType(int);
347
349
353 static const char* GetStereoTypeAsString(int type);
355
360 virtual void StereoUpdate();
361
366 virtual void StereoMidpoint();
367
372 virtual void StereoRenderComplete();
373
375
382 vtkSetClampMacro(AnaglyphColorSaturation, float, 0.0f, 1.0f);
383 vtkGetMacro(AnaglyphColorSaturation, float);
385
387
401 vtkSetVector2Macro(AnaglyphColorMask, int);
402 vtkGetVectorMacro(AnaglyphColorMask, int, 2);
404
410 virtual void WindowRemap() {}
411
413
418 vtkBooleanMacro(SwapBuffers, vtkTypeBool);
420
422
434 virtual int SetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, unsigned char* /*data*/,
435 int /*front*/, int /*right*/ = 0)
436 {
437 return 0;
438 }
439 virtual int SetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/,
440 vtkUnsignedCharArray* /*data*/, int /*front*/, int /*right*/ = 0)
441 {
442 return 0;
443 }
444
445
447
454 virtual float* GetRGBAPixelData(
455 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
456 {
457 return nullptr;
458 }
459 virtual int GetRGBAPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
460 vtkFloatArray* /*data*/, int /*right*/ = 0)
461 {
462 return 0;
463 }
464 virtual int SetRGBAPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, float*, int /*front*/,
465 int /*blend*/ = 0, int /*right*/ = 0)
466 {
467 return 0;
468 }
469 virtual int SetRGBAPixelData(
470 int, int, int, int, vtkFloatArray*, int, int /*blend*/ = 0, int /*right*/ = 0)
471 {
472 return 0;
473 }
474 virtual void ReleaseRGBAPixelData(float* /*data*/) {}
475 virtual unsigned char* GetRGBACharPixelData(
476 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
477 {
478 return nullptr;
479 }
480 virtual int GetRGBACharPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
481 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
482 {
483 return 0;
484 }
485 virtual int SetRGBACharPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/,
486 unsigned char* /*data*/, int /*front*/, int /*blend*/ = 0, int /*right*/ = 0)
487 {
488 return 0;
489 }
490 virtual int SetRGBACharPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/,
491 vtkUnsignedCharArray* /*data*/, int /*front*/, int /*blend*/ = 0, int /*right*/ = 0)
492 {
493 return 0;
494 }
495
496
498
503 virtual float* GetZbufferData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/) { return nullptr; }
504 virtual int GetZbufferData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, float* /*z*/)
505 {
506 return 0;
507 }
508 virtual int GetZbufferData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, vtkFloatArray* /*z*/)
509 {
510 return 0;
511 }
512 virtual int SetZbufferData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, float* /*z*/)
513 {
514 return 0;
515 }
516 virtual int SetZbufferData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, vtkFloatArray* /*z*/)
517 {
518 return 0;
519 }
520 float GetZbufferDataAtPoint(int x, int y)
521 {
522 float value;
523 this->GetZbufferData(x, y, x, y, &value);
524 return value;
525 }
526
527
529
532 vtkGetMacro(NeverRendered, int);
534
536
540 vtkGetMacro(AbortRender, int);
541 vtkSetMacro(AbortRender, int);
542 vtkGetMacro(InAbortCheck, int);
543 vtkSetMacro(InAbortCheck, int);
544 virtual int CheckAbortStatus();
546
553 virtual vtkTypeBool GetEventPending() { return 0; }
554
558 virtual int CheckInRenderStatus() { return this->InRender; }
559
563 virtual void ClearInRenderStatus() { this->InRender = 0; }
564
566
574 virtual void SetDesiredUpdateRate(double);
575 vtkGetMacro(DesiredUpdateRate, double);
577
579
585 vtkGetMacro(NumberOfLayers, int);
586 vtkSetClampMacro(NumberOfLayers, int, 1, VTK_INT_MAX);
588
590
595
600
605 void UnRegister(vtkObjectBase* o) override;
606
608
611 void SetDisplayId(void*) override {}
612 void SetWindowId(void*) override {}
613 virtual void SetNextWindowId(void*) {}
614 void SetParentId(void*) override {}
615 void* GetGenericDisplayId() override { return nullptr; }
616 void* GetGenericWindowId() override { return nullptr; }
617 void* GetGenericParentId() override { return nullptr; }
618 void* GetGenericContext() override { return nullptr; }
619 void* GetGenericDrawable() override { return nullptr; }
620 void SetWindowInfo(const char*) override {}
621 virtual void SetNextWindowInfo(const char*) {}
622 void SetParentInfo(const char*) override {}
624
629 virtual bool InitializeFromCurrentContext() { return false; }
630
632
641 virtual bool GetPlatformSupportsRenderWindowSharing() { return false; }
643
648 virtual bool IsCurrent() { return false; }
649
657 "Deprecated in 9.1 because no one knows what it's for and nothing uses it")
658 virtual bool IsDrawable();
659
665 virtual void SetForceMakeCurrent() {}
666
670 virtual const char* ReportCapabilities() { return "Not Implemented"; }
671
675 virtual int SupportsOpenGL() { return 0; }
676
680 virtual vtkTypeBool IsDirect() { return 0; }
681
686 virtual int GetDepthBufferSize() { return 0; }
687
692 virtual int GetColorBufferSizes(int* /*rgba*/) { return 0; }
693
695
699 virtual void SetMultiSamples(int);
700 vtkGetMacro(MultiSamples, int);
702
704
709 vtkBooleanMacro(StencilCapable, vtkTypeBool);
711
713
719 vtkSetMacro(DeviceIndex, int);
720 vtkGetMacro(DeviceIndex, int);
722
726 virtual int GetNumberOfDevices() { return 0; }
727
729
733 vtkGetMacro(UseSRGBColorSpace, bool);
734 vtkSetMacro(UseSRGBColorSpace, bool);
735 vtkBooleanMacro(UseSRGBColorSpace, bool);
737
744
752 vtkEventDataDevice device, vtkMatrix4x4* deviceToWorldMatrix);
753
754protected:
757
758 virtual void DoStereoRender();
759
764 int OldScreen[5];
789
792
797
799
800private:
801 vtkRenderWindow(const vtkRenderWindow&) = delete;
802 void operator=(const vtkRenderWindow&) = delete;
803
804 vtkNew<vtkStereoCompositor> StereoCompositor;
805};
806
807#endif
create and manipulate ordered lists of objects
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition vtkIndent.h:34
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:56
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:51
Asynchronously measures GPU execution times for a series of events.
platform-independent render window interaction including picking and frame rate control.
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.
void SetStereoTypeToDresden()
Set/Get what type of stereo rendering to use.
virtual void SetDesiredUpdateRate(double)
Set/Get the desired update rate.
virtual void ReleaseRGBAPixelData(float *)
Same as Get/SetPixelData except that the image also contains an alpha component.
virtual int GetZbufferData(int, int, int, int, float *)
Set/Get the zbuffer data from the frame buffer.
void SetStereoType(int)
Set/Get what type of stereo rendering to use.
virtual int SetRGBACharPixelData(int, int, int, int, unsigned char *, int, int=0, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
virtual int SetZbufferData(int, int, int, int, float *)
Set/Get the zbuffer data from the frame buffer.
virtual bool IsDrawable()
Test if the window has a valid drawable.
void SetStereoTypeToRedBlue()
Set/Get what type of stereo rendering to use.
vtkNew< vtkRenderTimerLog > RenderTimer
void SetParentInfo(const char *) override
Dummy stubs for vtkWindow API.
virtual void Finalize()
Finalize the rendering process.
vtkGetFilePathMacro(CursorFileName)
Set/Get the full path to the custom cursor.
void * GetGenericParentId() override
Dummy stubs for vtkWindow API.
virtual bool GetPlatformSupportsRenderWindowSharing()
Set/Get an already existing window that this window should share data with if possible.
virtual const char * GetRenderingBackend()
What rendering backend has the user requested.
double AbortCheckTime
The universal time since the last abort check occurred.
virtual int SetRGBAPixelData(int, int, int, int, float *, int, int=0, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
virtual int SetPixelData(int, int, int, int, unsigned char *, int, int=0)
Set/Get the pixel data of an image, transmitted as RGBRGBRGB.
virtual void AddRenderer(vtkRenderer *)
Add a renderer to the list of renderers.
virtual const char * ReportCapabilities()
Get report of capabilities for the render window.
virtual void GetPhysicalToWorldMatrix(vtkMatrix4x4 *matrix)
Get physical to world transform matrix.
virtual void Frame()
A termination method performed at the end of the rendering process to do things like swapping buffers...
vtkTypeBool LineSmoothing
vtkRenderWindowInteractor * Interactor
void SetStereoTypeToFake()
Set/Get what type of stereo rendering to use.
virtual bool GetDeviceToWorldMatrixForDevice(vtkEventDataDevice device, vtkMatrix4x4 *deviceToWorldMatrix)
Store in deviceToWorldMatrix the matrix that goes from device coordinates to world coordinates.
static const char * GetStereoTypeAsString(int type)
Returns the stereo type as a string.
virtual int GetZbufferData(int, int, int, int, vtkFloatArray *)
Set/Get the zbuffer data from the frame buffer.
vtkTypeBool FullScreen
virtual void HideCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
void SetStereoTypeToInterlaced()
Set/Get what type of stereo rendering to use.
static vtkRenderWindow * New()
Construct an instance of vtkRenderWindow with its screen size set to 300x300, borders turned on,...
void CaptureGL2PSSpecialProps(vtkCollection *specialProps)
The GL2PS exporter must handle certain props in a special way (e.g.
virtual int GetRGBACharPixelData(int, int, int, int, int, vtkUnsignedCharArray *, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
float GetZbufferDataAtPoint(int x, int y)
Set/Get the zbuffer data from the frame buffer.
virtual void WaitForCompletion()
Block the thread until the actual rendering is finished().
virtual void StereoRenderComplete()
Handles work required once both views have been rendered when using stereo rendering.
virtual void SetStereoCapableWindow(vtkTypeBool capable)
Prescribe that the window be created in a stereo-capable mode.
virtual int SetPixelData(int, int, int, int, vtkUnsignedCharArray *, int, int=0)
Set/Get the pixel data of an image, transmitted as RGBRGBRGB.
vtkTypeBool PolygonSmoothing
virtual vtkRenderWindowInteractor * MakeRenderWindowInteractor()
Create an interactor to control renderers in this window.
~vtkRenderWindow() override
virtual int GetDepthBufferSize()
This method should be defined by the subclass.
void SetStereoRender(vtkTypeBool stereo)
Turn on/off stereo rendering.
void SetStereoTypeToLeft()
Set/Get what type of stereo rendering to use.
virtual void SetFullScreen(vtkTypeBool)
Turn on/off rendering full screen window size.
virtual void SetNextWindowId(void *)
Dummy stubs for vtkWindow API.
virtual bool InitializeFromCurrentContext()
Initialize the render window from the information associated with the currently activated OpenGL cont...
void SetWindowInfo(const char *) override
Dummy stubs for vtkWindow API.
virtual void DoStereoRender()
virtual int GetRGBAPixelData(int, int, int, int, int, vtkFloatArray *, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
virtual void SetNextWindowInfo(const char *)
Dummy stubs for vtkWindow API.
virtual void ClearInRenderStatus()
Clear status (after an exception was thrown for example)
virtual float * GetZbufferData(int, int, int, int)
Set/Get the zbuffer data from the frame buffer.
void Render() override
Ask each renderer owned by this RenderWindow to render its image and synchronize this process.
void * GetGenericContext() override
Dummy stubs for vtkWindow API.
vtkSmartPointer< vtkUnsignedCharArray > ResultFrame
void SetParentId(void *) override
Dummy stubs for vtkWindow API.
virtual void SetInteractor(vtkRenderWindowInteractor *)
Set the interactor to the render window.
virtual void End()
Update the system, if needed, at end of render process.
virtual int CheckAbortStatus()
This is a flag that can be set to interrupt a rendering that is in progress.
virtual void SetForceMakeCurrent()
If called, allow MakeCurrent() to skip cache-check when called.
void SetWindowId(void *) override
Dummy stubs for vtkWindow API.
void SetStereoTypeToCheckerboard()
Set/Get what type of stereo rendering to use.
void UnRegister(vtkObjectBase *o) override
This Method detects loops of RenderWindow<->Interactor, so objects are freed properly.
virtual int SupportsOpenGL()
Does this render window support OpenGL?
vtkTypeBool AlphaBitPlanes
vtkRenderWindow * SharedRenderWindow
virtual void StereoUpdate()
Update the system, if needed, due to stereo rendering.
virtual void SetMultiSamples(int)
Set / Get the number of multisamples to use for hardware antialiasing.
virtual void Start()
Start the rendering process for a frame.
void SetStereoTypeToAnaglyph()
Set/Get what type of stereo rendering to use.
virtual void CopyResultFrame()
Performed at the end of the rendering process to generate image.
virtual int SetRGBACharPixelData(int, int, int, int, vtkUnsignedCharArray *, int, int=0, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
vtkRendererCollection * Renderers
virtual unsigned char * GetRGBACharPixelData(int, int, int, int, int, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
virtual int SetRGBAPixelData(int, int, int, int, vtkFloatArray *, int, int=0, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
vtkTypeBool StencilCapable
static const char * GetRenderLibrary()
What rendering library has the user requested.
void * GetGenericWindowId() override
Dummy stubs for vtkWindow API.
virtual void WindowRemap()
Remap the rendering window.
void RemoveRenderer(vtkRenderer *)
Remove a renderer from the list of renderers.
virtual int SetZbufferData(int, int, int, int, vtkFloatArray *)
Set/Get the zbuffer data from the frame buffer.
vtkTypeBool StereoRender
virtual int GetColorBufferSizes(int *)
Get the size of the color buffer.
vtkGetNewMacro(RenderTimer, vtkRenderTimerLog)
Get the render timer log for this window.
virtual void SetSharedRenderWindow(vtkRenderWindow *)
Set/Get an already existing window that this window should share data with if possible.
vtkTypeBool PointSmoothing
vtkTypeBool StereoCapableWindow
virtual void SetCursorPosition(int, int)
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
virtual vtkTypeBool GetEventPending()
Check to see if a mouse button has been pressed.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void StereoMidpoint()
Intermediate method performs operations required between the rendering of the left and right eye.
void SetDisplayId(void *) override
Dummy stubs for vtkWindow API.
void SetStereoTypeToEmulate()
Set/Get what type of stereo rendering to use.
vtkSetFilePathMacro(CursorFileName)
Set/Get the full path to the custom cursor.
void SetStereoTypeToSplitViewportHorizontal()
Set/Get what type of stereo rendering to use.
int HasRenderer(vtkRenderer *)
Query if a renderer is in the list of renderers.
virtual int GetNumberOfDevices()
Returns the number of devices (graphics cards) on a system.
virtual void ShowCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
vtkSmartPointer< vtkUnsignedCharArray > StereoBuffer
virtual float * GetRGBAPixelData(int, int, int, int, int, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
virtual vtkTypeBool IsDirect()
Is this render window using hardware acceleration?
vtkRendererCollection * GetRenderers()
Return the collection of renderers in the render window.
void SetStereoTypeToCrystalEyes()
Set/Get what type of stereo rendering to use.
vtkTypeBool SwapBuffers
void SetStereoTypeToRight()
Set/Get what type of stereo rendering to use.
virtual int CheckInRenderStatus()
Are we rendering at the moment.
vtkTypeBool Borders
void * GetGenericDisplayId() override
Dummy stubs for vtkWindow API.
virtual bool IsCurrent()
Tells if this window is the current graphics context for the calling thread.
const char * GetStereoTypeAsString()
Returns the stereo type as a string.
an ordered list of renderers
abstract specification for renderers
Definition vtkRenderer.h:67
Hold a reference to a vtkObjectBase instance.
helper class to generate composited stereo images.
dynamic, self-adjusting array of unsigned char
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_DEPRECATED_IN_9_1_0(reason)
vtkEventDataDevice
platform-independent event data structures
#define VTK_STEREO_ANAGLYPH
#define VTK_STEREO_SPLITVIEWPORT_HORIZONTAL
#define VTK_STEREO_DRESDEN
#define VTK_STEREO_CHECKERBOARD
#define VTK_STEREO_CRYSTAL_EYES
#define VTK_STEREO_RIGHT
#define VTK_STEREO_FAKE
#define VTK_STEREO_RED_BLUE
#define VTK_STEREO_INTERLACED
#define VTK_STEREO_EMULATE
#define VTK_STEREO_LEFT
#define VTK_INT_MAX
Definition vtkType.h:155