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 
75 #define VTK_CURSOR_DEFAULT 0
76 #define VTK_CURSOR_ARROW 1
77 #define VTK_CURSOR_SIZENE 2
78 #define VTK_CURSOR_SIZENW 3
79 #define VTK_CURSOR_SIZESW 4
80 #define VTK_CURSOR_SIZESE 5
81 #define VTK_CURSOR_SIZENS 6
82 #define VTK_CURSOR_SIZEWE 7
83 #define VTK_CURSOR_SIZEALL 8
84 #define VTK_CURSOR_HAND 9
85 #define VTK_CURSOR_CROSSHAIR 10
86 
87 #ifndef VTK_LEGACY_REMOVE
88 // This macro should not be used, see vtkOpenGLError.h for
89 // GL error handling functions and macros.
90 #if defined NDEBUG
91 # define vtkGraphicErrorMacro(renderWindow,message) \
92  renderWindow->CheckGraphicError();
93 #else
94 # define vtkGraphicErrorMacro(renderWindow,message) \
95  renderWindow->CheckGraphicError(); \
96  if ( renderWindow->GetReportGraphicErrors() \
97  && renderWindow->HasGraphicError() ) \
98  { \
99  vtkErrorMacro( \
100  << message << " " \
101  << renderWindow->GetLastGraphicErrorString()); \
102  }
103 # endif
104 #endif
105 
107 {
108 public:
110  void PrintSelf(ostream& os, vtkIndent indent);
111 
115  static vtkRenderWindow *New();
116 
118  virtual void AddRenderer(vtkRenderer *);
119 
121  void RemoveRenderer(vtkRenderer *);
122 
124  int HasRenderer(vtkRenderer *);
125 
127  static const char *GetRenderLibrary();
128 
130  vtkRendererCollection *GetRenderers() {return this->Renderers;};
131 
137  void CaptureGL2PSSpecialProps(vtkCollection *specialProps);
138 
140 
141  vtkGetMacro(CapturingGL2PSSpecialProps, int);
143 
146  virtual void Render();
147 
149  virtual void Start() = 0;
150 
152  virtual void Finalize() = 0;
153 
156  virtual void Frame() = 0;
157 
160  virtual void WaitForCompletion()=0;
161 
164  virtual void CopyResultFrame();
165 
169  virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor();
170 
172 
175  virtual void HideCursor() = 0;
176  virtual void ShowCursor() = 0;
177  virtual void SetCursorPosition(int , int ) {}
179 
181 
182  vtkSetMacro(CurrentCursor,int);
183  vtkGetMacro(CurrentCursor,int);
185 
187 
188  virtual void SetFullScreen(int) = 0;
189  vtkGetMacro(FullScreen,int);
190  vtkBooleanMacro(FullScreen,int);
192 
194 
197  vtkSetMacro(Borders,int);
198  vtkGetMacro(Borders,int);
199  vtkBooleanMacro(Borders,int);
201 
203 
205  vtkGetMacro(StereoCapableWindow,int);
206  vtkBooleanMacro(StereoCapableWindow,int);
207  virtual void SetStereoCapableWindow(int capable);
209 
211 
212  vtkGetMacro(StereoRender,int);
213  void SetStereoRender(int stereo);
214  vtkBooleanMacro(StereoRender,int);
216 
218 
219  vtkSetMacro(AlphaBitPlanes, int);
220  vtkGetMacro(AlphaBitPlanes, int);
221  vtkBooleanMacro(AlphaBitPlanes, int);
223 
225 
227  vtkSetMacro(PointSmoothing,int);
228  vtkGetMacro(PointSmoothing,int);
229  vtkBooleanMacro(PointSmoothing,int);
231 
233 
235  vtkSetMacro(LineSmoothing,int);
236  vtkGetMacro(LineSmoothing,int);
237  vtkBooleanMacro(LineSmoothing,int);
239 
241 
243  vtkSetMacro(PolygonSmoothing,int);
244  vtkGetMacro(PolygonSmoothing,int);
245  vtkBooleanMacro(PolygonSmoothing,int);
247 
249 
261  vtkGetMacro(StereoType,int);
262  vtkSetMacro(StereoType,int);
264  {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);}
266  {this->SetStereoType(VTK_STEREO_RED_BLUE);}
268  {this->SetStereoType(VTK_STEREO_INTERLACED);}
270  {this->SetStereoType(VTK_STEREO_LEFT);}
272  {this->SetStereoType(VTK_STEREO_RIGHT);}
274  {this->SetStereoType(VTK_STEREO_DRESDEN);}
276  {this->SetStereoType(VTK_STEREO_ANAGLYPH);}
278  {this->SetStereoType(VTK_STEREO_CHECKERBOARD);}
280  {this->SetStereoType(VTK_STEREO_SPLITVIEWPORT_HORIZONTAL);}
282 
283  const char *GetStereoTypeAsString();
284 
288  virtual void StereoUpdate();
289 
292  virtual void StereoMidpoint();
293 
296  virtual void StereoRenderComplete();
297 
299 
304  vtkSetClampMacro(AnaglyphColorSaturation,float, 0.0f, 1.0f);
305  vtkGetMacro(AnaglyphColorSaturation,float);
307 
309 
320  vtkSetVector2Macro(AnaglyphColorMask,int);
321  vtkGetVectorMacro(AnaglyphColorMask,int,2);
323 
327  virtual void WindowRemap() = 0;
328 
330 
331  vtkSetMacro(SwapBuffers,int);
332  vtkGetMacro(SwapBuffers,int);
333  vtkBooleanMacro(SwapBuffers,int);
335 
337 
346  virtual int SetPixelData(int x, int y, int x2, int y2, unsigned char *data,
347  int front) = 0;
348  virtual int SetPixelData(int x, int y, int x2, int y2,
349  vtkUnsignedCharArray *data, int front) = 0;
351 
353 
358  virtual float *GetRGBAPixelData(int x, int y, int x2, int y2, int front) = 0;
359  virtual int GetRGBAPixelData(int x, int y, int x2, int y2, int front,
360  vtkFloatArray *data) = 0;
361  virtual int SetRGBAPixelData(int x, int y, int x2, int y2, float *,
362  int front, int blend=0) = 0;
363  virtual int SetRGBAPixelData(int, int, int, int, vtkFloatArray*,
364  int, int blend=0) = 0;
365  virtual void ReleaseRGBAPixelData(float *data)=0;
366  virtual unsigned char *GetRGBACharPixelData(int x, int y, int x2, int y2,
367  int front) = 0;
368  virtual int GetRGBACharPixelData(int x, int y, int x2, int y2, int front,
370  virtual int SetRGBACharPixelData(int x,int y, int x2, int y2,
371  unsigned char *data, int front,
372  int blend=0) = 0;
373  virtual int SetRGBACharPixelData(int x, int y, int x2, int y2,
374  vtkUnsignedCharArray *data, int front,
375  int blend=0) = 0;
377 
379 
381  virtual float *GetZbufferData(int x, int y, int x2, int y2) = 0;
382  virtual int GetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
383  virtual int GetZbufferData(int x, int y, int x2, int y2,
384  vtkFloatArray *z) = 0;
385  virtual int SetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
386  virtual int SetZbufferData(int x, int y, int x2, int y2,
387  vtkFloatArray *z) = 0;
388  float GetZbufferDataAtPoint(int x, int y)
389  {
390  float value;
391  this->GetZbufferData(x, y, x, y, &value);
392  return value;
393  }
395 
397 
400  vtkGetMacro(AAFrames,int);
401  vtkSetMacro(AAFrames,int);
403 
405 
410  vtkGetMacro(FDFrames,int);
411  virtual void SetFDFrames (int fdFrames);
413 
415 
420  vtkGetMacro(UseConstantFDOffsets,int);
421  vtkSetMacro(UseConstantFDOffsets,int);
423 
425 
431  vtkGetMacro(SubFrames,int);
432  virtual void SetSubFrames(int subFrames);
434 
436 
437  vtkGetMacro(NeverRendered,int);
439 
441 
443  vtkGetMacro(AbortRender,int);
444  vtkSetMacro(AbortRender,int);
445  vtkGetMacro(InAbortCheck,int);
446  vtkSetMacro(InAbortCheck,int);
447  virtual int CheckAbortStatus();
449 
450  vtkGetMacro(IsPicking,int);
451  vtkSetMacro(IsPicking,int);
452  vtkBooleanMacro(IsPicking,int);
453 
458  virtual int GetEventPending() = 0;
459 
461  virtual int CheckInRenderStatus() { return this->InRender; }
462 
464  virtual void ClearInRenderStatus() { this->InRender = 0; }
465 
467 
472  virtual void SetDesiredUpdateRate(double);
473  vtkGetMacro(DesiredUpdateRate,double);
475 
477 
481  vtkGetMacro(NumberOfLayers, int);
482  vtkSetClampMacro(NumberOfLayers, int, 1, VTK_INT_MAX);
484 
486 
489 
491  void SetInteractor(vtkRenderWindowInteractor *);
492 
495  virtual void UnRegister(vtkObjectBase *o);
496 
498 
499  virtual void SetDisplayId(void *) = 0;
500  virtual void SetWindowId(void *) = 0;
501  virtual void SetNextWindowId(void *) = 0;
502  virtual void SetParentId(void *) = 0;
503  virtual void *GetGenericDisplayId() = 0;
504  virtual void *GetGenericWindowId() = 0;
505  virtual void *GetGenericParentId() = 0;
506  virtual void *GetGenericContext() = 0;
507  virtual void *GetGenericDrawable() = 0;
508  virtual void SetWindowInfo(char *) = 0;
509  virtual void SetNextWindowInfo(char *) = 0;
510  virtual void SetParentInfo(char *) = 0;
512 
515  virtual bool InitializeFromCurrentContext() { return false; };
516 
519  virtual void MakeCurrent() = 0;
520 
523  virtual bool IsCurrent()=0;
524 
529  virtual bool IsDrawable(){ return true; }
530 
534  virtual void SetForceMakeCurrent() {}
535 
537  virtual const char *ReportCapabilities() { return "Not Implemented";};
538 
540  virtual int SupportsOpenGL() { return 0;};
541 
543  virtual int IsDirect() { return 0;};
544 
547  virtual int GetDepthBufferSize() = 0;
548 
551  virtual int GetColorBufferSizes(int *rgba) = 0;
552 
554 
556  vtkGetObjectMacro(PainterDeviceAdapter, vtkPainterDeviceAdapter);
558 
560 
562  vtkSetMacro(MultiSamples,int);
563  vtkGetMacro(MultiSamples,int);
565 
567 
568  vtkSetMacro(StencilCapable, int);
569  vtkGetMacro(StencilCapable, int);
570  vtkBooleanMacro(StencilCapable, int);
572 
574 
577  VTK_LEGACY(void SetReportGraphicErrors(int val));
578  VTK_LEGACY(void SetReportGraphicErrorsOn());
579  VTK_LEGACY(void SetReportGraphicErrorsOff());
580  VTK_LEGACY(int GetReportGraphicErrors());
582 
583 #ifndef VTK_LEGACY_REMOVE
584 
585 
586  virtual void CheckGraphicError() = 0;
587  virtual int HasGraphicError() = 0;
588  virtual const char *GetLastGraphicErrorString() = 0;
589 #endif
590 
591 
592 protected:
593  vtkRenderWindow();
594  ~vtkRenderWindow();
595 
596  virtual void DoStereoRender();
597  virtual void DoFDRender();
598  virtual void DoAARender();
599 
602  int Borders;
604  int OldScreen[5];
610  int StereoStatus; // used for keeping track of what's going on
614  unsigned char* StereoBuffer; // used for red blue stereo
615  float *AccumulationBuffer; // used for many techniques
617  int AAFrames;
618  int FDFrames;
619  int UseConstantFDOffsets; // to use the same offsets at each rendering
620  double *ConstantFDOffsets[2];
621  int SubFrames; // number of sub frames
622  int CurrentSubFrame; // what one are we on
623  unsigned char *ResultFrame; // used for any non immediate rendering
628  int InRender;
634  int AnaglyphColorMask[2];
638 
639 #ifndef VTK_LEGACY_REMOVE
640 
641 
645 #endif
646 
647 
650 
651 private:
652  vtkRenderWindow(const vtkRenderWindow&); // Not implemented.
653  void operator=(const vtkRenderWindow&); // Not implemented.
654 };
655 
656 #endif
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:47
virtual void SetForceMakeCurrent()
void SetStereoTypeToRight()
virtual void * GetGenericDrawable()=0
GLclampf f
Definition: vtkgl.h:14181
virtual void SetDisplayId(void *)=0
#define VTK_STEREO_RIGHT
float AnaglyphColorSaturation
#define VTK_STEREO_CHECKERBOARD
#define VTK_INT_MAX
Definition: vtkType.h:131
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
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
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
virtual void SetParentInfo(char *)=0
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
virtual void * GetGenericContext()=0
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
#define VTK_STEREO_INTERLACED
void SetStereoTypeToCrystalEyes()
GLdouble GLdouble z
Definition: vtkgl.h:11754
window superclass for vtkRenderWindow
Definition: vtkWindow.h:33
unsigned char * ResultFrame
platform-independent render window interaction including picking and frame rate control.
virtual const char * ReportCapabilities()
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
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:58
virtual void MakeCurrent()
Definition: vtkWindow.h:143
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
#define VTK_STEREO_CRYSTAL_EYES
vtkRendererCollection * GetRenderers()
dynamic, self-adjusting array of unsigned char
#define VTK_LEGACY(method)
Definition: vtkSetGet.h:787
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
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
vtkRenderWindowInteractor * Interactor
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
unsigned char * StereoBuffer
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:414
#define vtkSetVector2Macro(name, type)
Definition: vtkSetGet.h:244
#define VTK_STEREO_LEFT
virtual void * GetGenericParentId()=0
virtual void Render()=0
void SetStereoTypeToLeft()
#define VTK_STEREO_ANAGLYPH
virtual bool IsDrawable()
GLuint GLfloat * val
Definition: vtkgl.h:13789
virtual void * GetGenericWindowId()=0
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69
vtkRendererCollection * Renderers