VTK
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 =========================================================================*/
49 #ifndef vtkRenderWindow_h
50 #define vtkRenderWindow_h
51 
52 #include "vtkRenderingCoreModule.h" // For export macro
53 #include "vtkWindow.h"
54 
55 class vtkFloatArray;
57 class vtkProp;
58 class vtkCollection;
60 class vtkRenderer;
63 
64 // lets define the different types of stereo
65 #define VTK_STEREO_CRYSTAL_EYES 1
66 #define VTK_STEREO_RED_BLUE 2
67 #define VTK_STEREO_INTERLACED 3
68 #define VTK_STEREO_LEFT 4
69 #define VTK_STEREO_RIGHT 5
70 #define VTK_STEREO_DRESDEN 6
71 #define VTK_STEREO_ANAGLYPH 7
72 #define VTK_STEREO_CHECKERBOARD 8
73 #define VTK_STEREO_SPLITVIEWPORT_HORIZONTAL 9
74 #define VTK_STEREO_FAKE 10
75 
76 #define VTK_CURSOR_DEFAULT 0
77 #define VTK_CURSOR_ARROW 1
78 #define VTK_CURSOR_SIZENE 2
79 #define VTK_CURSOR_SIZENW 3
80 #define VTK_CURSOR_SIZESW 4
81 #define VTK_CURSOR_SIZESE 5
82 #define VTK_CURSOR_SIZENS 6
83 #define VTK_CURSOR_SIZEWE 7
84 #define VTK_CURSOR_SIZEALL 8
85 #define VTK_CURSOR_HAND 9
86 #define VTK_CURSOR_CROSSHAIR 10
87 
89 {
90 public:
91  vtkTypeMacro(vtkRenderWindow,vtkWindow);
92  void PrintSelf(ostream& os, vtkIndent indent);
93 
97  static vtkRenderWindow *New();
98 
100  virtual void AddRenderer(vtkRenderer *);
101 
103  void RemoveRenderer(vtkRenderer *);
104 
106  int HasRenderer(vtkRenderer *);
107 
109  static const char *GetRenderLibrary();
110 
112  vtkRendererCollection *GetRenderers() {return this->Renderers;};
113 
119  void CaptureGL2PSSpecialProps(vtkCollection *specialProps);
120 
122 
123  vtkGetMacro(CapturingGL2PSSpecialProps, int);
125 
128  virtual void Render();
129 
131  virtual void Start() = 0;
132 
134  virtual void Finalize() = 0;
135 
138  virtual void Frame() = 0;
139 
142  virtual void WaitForCompletion()=0;
143 
146  virtual void CopyResultFrame();
147 
151  virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor();
152 
154 
157  virtual void HideCursor() = 0;
158  virtual void ShowCursor() = 0;
159  virtual void SetCursorPosition(int , int ) {}
161 
163 
164  vtkSetMacro(CurrentCursor,int);
165  vtkGetMacro(CurrentCursor,int);
167 
169 
170  virtual void SetFullScreen(int) = 0;
171  vtkGetMacro(FullScreen,int);
172  vtkBooleanMacro(FullScreen,int);
174 
176 
179  vtkSetMacro(Borders,int);
180  vtkGetMacro(Borders,int);
181  vtkBooleanMacro(Borders,int);
183 
185 
187  vtkGetMacro(StereoCapableWindow,int);
188  vtkBooleanMacro(StereoCapableWindow,int);
189  virtual void SetStereoCapableWindow(int capable);
191 
193 
194  vtkGetMacro(StereoRender,int);
195  void SetStereoRender(int stereo);
196  vtkBooleanMacro(StereoRender,int);
198 
200 
201  vtkSetMacro(AlphaBitPlanes, int);
202  vtkGetMacro(AlphaBitPlanes, int);
203  vtkBooleanMacro(AlphaBitPlanes, int);
205 
207 
209  vtkSetMacro(PointSmoothing,int);
210  vtkGetMacro(PointSmoothing,int);
211  vtkBooleanMacro(PointSmoothing,int);
213 
215 
217  vtkSetMacro(LineSmoothing,int);
218  vtkGetMacro(LineSmoothing,int);
219  vtkBooleanMacro(LineSmoothing,int);
221 
223 
225  vtkSetMacro(PolygonSmoothing,int);
226  vtkGetMacro(PolygonSmoothing,int);
227  vtkBooleanMacro(PolygonSmoothing,int);
229 
231 
246  vtkGetMacro(StereoType,int);
247  vtkSetMacro(StereoType,int);
249  {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);}
251  {this->SetStereoType(VTK_STEREO_RED_BLUE);}
253  {this->SetStereoType(VTK_STEREO_INTERLACED);}
255  {this->SetStereoType(VTK_STEREO_LEFT);}
257  {this->SetStereoType(VTK_STEREO_RIGHT);}
259  {this->SetStereoType(VTK_STEREO_DRESDEN);}
261  {this->SetStereoType(VTK_STEREO_ANAGLYPH);}
263  {this->SetStereoType(VTK_STEREO_CHECKERBOARD);}
265  {this->SetStereoType(VTK_STEREO_SPLITVIEWPORT_HORIZONTAL);}
267  {this->SetStereoType(VTK_STEREO_FAKE);}
269 
270  const char *GetStereoTypeAsString();
271 
275  virtual void StereoUpdate();
276 
279  virtual void StereoMidpoint();
280 
283  virtual void StereoRenderComplete();
284 
286 
291  vtkSetClampMacro(AnaglyphColorSaturation,float, 0.0f, 1.0f);
292  vtkGetMacro(AnaglyphColorSaturation,float);
294 
296 
307  vtkSetVector2Macro(AnaglyphColorMask,int);
308  vtkGetVectorMacro(AnaglyphColorMask,int,2);
310 
314  virtual void WindowRemap() = 0;
315 
317 
318  vtkSetMacro(SwapBuffers,int);
319  vtkGetMacro(SwapBuffers,int);
320  vtkBooleanMacro(SwapBuffers,int);
322 
324 
333  virtual int SetPixelData(int x, int y, int x2, int y2, unsigned char *data,
334  int front) = 0;
335  virtual int SetPixelData(int x, int y, int x2, int y2,
336  vtkUnsignedCharArray *data, int front) = 0;
338 
340 
345  virtual float *GetRGBAPixelData(int x, int y, int x2, int y2, int front) = 0;
346  virtual int GetRGBAPixelData(int x, int y, int x2, int y2, int front,
347  vtkFloatArray *data) = 0;
348  virtual int SetRGBAPixelData(int x, int y, int x2, int y2, float *,
349  int front, int blend=0) = 0;
350  virtual int SetRGBAPixelData(int, int, int, int, vtkFloatArray*,
351  int, int blend=0) = 0;
352  virtual void ReleaseRGBAPixelData(float *data)=0;
353  virtual unsigned char *GetRGBACharPixelData(int x, int y, int x2, int y2,
354  int front) = 0;
355  virtual int GetRGBACharPixelData(int x, int y, int x2, int y2, int front,
357  virtual int SetRGBACharPixelData(int x,int y, int x2, int y2,
358  unsigned char *data, int front,
359  int blend=0) = 0;
360  virtual int SetRGBACharPixelData(int x, int y, int x2, int y2,
361  vtkUnsignedCharArray *data, int front,
362  int blend=0) = 0;
364 
366 
368  virtual float *GetZbufferData(int x, int y, int x2, int y2) = 0;
369  virtual int GetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
370  virtual int GetZbufferData(int x, int y, int x2, int y2,
371  vtkFloatArray *z) = 0;
372  virtual int SetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
373  virtual int SetZbufferData(int x, int y, int x2, int y2,
374  vtkFloatArray *z) = 0;
375  float GetZbufferDataAtPoint(int x, int y)
376  {
377  float value;
378  this->GetZbufferData(x, y, x, y, &value);
379  return value;
380  }
382 
384 
387  vtkGetMacro(AAFrames,int);
388  vtkSetMacro(AAFrames,int);
390 
392 
397  vtkGetMacro(FDFrames,int);
398  virtual void SetFDFrames (int fdFrames);
400 
402 
407  vtkGetMacro(UseConstantFDOffsets,int);
408  vtkSetMacro(UseConstantFDOffsets,int);
410 
412 
418  vtkGetMacro(SubFrames,int);
419  virtual void SetSubFrames(int subFrames);
421 
423 
424  vtkGetMacro(NeverRendered,int);
426 
428 
430  vtkGetMacro(AbortRender,int);
431  vtkSetMacro(AbortRender,int);
432  vtkGetMacro(InAbortCheck,int);
433  vtkSetMacro(InAbortCheck,int);
434  virtual int CheckAbortStatus();
436 
437  vtkGetMacro(IsPicking,int);
438  vtkSetMacro(IsPicking,int);
439  vtkBooleanMacro(IsPicking,int);
440 
445  virtual int GetEventPending() = 0;
446 
448  virtual int CheckInRenderStatus() { return this->InRender; }
449 
451  virtual void ClearInRenderStatus() { this->InRender = 0; }
452 
454 
459  virtual void SetDesiredUpdateRate(double);
460  vtkGetMacro(DesiredUpdateRate,double);
462 
464 
468  vtkGetMacro(NumberOfLayers, int);
469  vtkSetClampMacro(NumberOfLayers, int, 1, VTK_INT_MAX);
471 
473 
474  vtkGetObjectMacro(Interactor,vtkRenderWindowInteractor);
476 
478  void SetInteractor(vtkRenderWindowInteractor *);
479 
482  virtual void UnRegister(vtkObjectBase *o);
483 
485 
486  virtual void SetDisplayId(void *) = 0;
487  virtual void SetWindowId(void *) = 0;
488  virtual void SetNextWindowId(void *) = 0;
489  virtual void SetParentId(void *) = 0;
490  virtual void *GetGenericDisplayId() = 0;
491  virtual void *GetGenericWindowId() = 0;
492  virtual void *GetGenericParentId() = 0;
493  virtual void *GetGenericContext() = 0;
494  virtual void *GetGenericDrawable() = 0;
495  virtual void SetWindowInfo(char *) = 0;
496  virtual void SetNextWindowInfo(char *) = 0;
497  virtual void SetParentInfo(char *) = 0;
499 
502  virtual bool InitializeFromCurrentContext() { return false; };
503 
506  virtual void MakeCurrent() = 0;
507 
510  virtual bool IsCurrent()=0;
511 
516  virtual bool IsDrawable(){ return true; }
517 
521  virtual void SetForceMakeCurrent() {}
522 
524  virtual const char *ReportCapabilities() { return "Not Implemented";};
525 
527  virtual int SupportsOpenGL() { return 0;};
528 
530  virtual int IsDirect() { return 0;};
531 
534  virtual int GetDepthBufferSize() = 0;
535 
538  virtual int GetColorBufferSizes(int *rgba) = 0;
539 
541 
543  vtkGetObjectMacro(PainterDeviceAdapter, vtkPainterDeviceAdapter);
545 
547 
549  vtkSetMacro(MultiSamples,int);
550  vtkGetMacro(MultiSamples,int);
552 
554 
555  vtkSetMacro(StencilCapable, int);
556  vtkGetMacro(StencilCapable, int);
557  vtkBooleanMacro(StencilCapable, int);
559 
560 protected:
561  vtkRenderWindow();
562  ~vtkRenderWindow();
563 
564  virtual void DoStereoRender();
565  virtual void DoFDRender();
566  virtual void DoAARender();
567 
570  int Borders;
572  int OldScreen[5];
578  int StereoStatus; // used for keeping track of what's going on
582  unsigned char* StereoBuffer; // used for red blue stereo
583  float *AccumulationBuffer; // used for many techniques
585  int AAFrames;
586  int FDFrames;
587  int UseConstantFDOffsets; // to use the same offsets at each rendering
588  double *ConstantFDOffsets[2];
589  int SubFrames; // number of sub frames
590  int CurrentSubFrame; // what one are we on
591  unsigned char *ResultFrame; // used for any non immediate rendering
596  int InRender;
602  int AnaglyphColorMask[2];
606 
609 
610 private:
611  vtkRenderWindow(const vtkRenderWindow&); // Not implemented.
612  void operator=(const vtkRenderWindow&); // Not implemented.
613 };
614 
615 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
virtual void SetForceMakeCurrent()
void SetStereoTypeToRight()
virtual void * GetGenericDrawable()=0
virtual void SetDisplayId(void *)=0
#define VTK_STEREO_RIGHT
void SetStereoTypeToFake()
#define VTK_STEREO_FAKE
float AnaglyphColorSaturation
#define VTK_STEREO_CHECKERBOARD
#define VTK_INT_MAX
Definition: vtkType.h:132
float * AccumulationBuffer
vtkPainterDeviceAdapter * PainterDeviceAdapter
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
void SetStereoTypeToSplitViewportHorizontal()
#define VTK_STEREO_DRESDEN
void SetStereoTypeToAnaglyph()
#define VTK_STEREO_RED_BLUE
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void SetParentInfo(char *)=0
virtual void * GetGenericContext()=0
#define VTK_STEREO_INTERLACED
void SetStereoTypeToCrystalEyes()
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
unsigned char * ResultFrame
platform-independent render window interaction including picking and frame rate control.
virtual const char * ReportCapabilities()
virtual int IsDirect()
virtual int SupportsOpenGL()
a list of renderers
An adapter between a vtkPainter and a rendering device.
virtual int CheckInRenderStatus()
virtual void UnRegister(vtkObjectBase *o)
void SetStereoTypeToRedBlue()
unsigned int AccumulationBufferSize
a simple class to control print indentation
Definition: vtkIndent.h:38
void SetStereoTypeToCheckerboard()
float GetZbufferDataAtPoint(int x, int y)
void SetStereoTypeToInterlaced()
virtual void SetWindowId(void *)=0
virtual void SetCursorPosition(int, int)
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
virtual void MakeCurrent()
Definition: vtkWindow.h:152
#define VTK_STEREO_CRYSTAL_EYES
vtkRendererCollection * GetRenderers()
dynamic, self-adjusting array of unsigned char
virtual void SetParentId(void *)=0
void SetStereoTypeToDresden()
virtual void SetWindowInfo(char *)=0
create a window for renderers to draw into
#define VTK_STEREO_SPLITVIEWPORT_HORIZONTAL
virtual bool InitializeFromCurrentContext()
virtual void ClearInRenderStatus()
create and manipulate unsorted lists of objects
Definition: vtkCollection.h:52
virtual void * GetGenericDisplayId()=0
#define VTKRENDERINGCORE_EXPORT
vtkRenderWindowInteractor * Interactor
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
unsigned char * StereoBuffer
#define VTK_STEREO_LEFT
virtual void * GetGenericParentId()=0
virtual void Render()=0
void SetStereoTypeToLeft()
#define VTK_STEREO_ANAGLYPH
virtual bool IsDrawable()
virtual void * GetGenericWindowId()=0
vtkRendererCollection * Renderers