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 "vtkWindow.h"
53 
54 class vtkFloatArray;
57 class vtkRenderer;
60 
61 // lets define the different types of stereo
62 #define VTK_STEREO_CRYSTAL_EYES 1
63 #define VTK_STEREO_RED_BLUE 2
64 #define VTK_STEREO_INTERLACED 3
65 #define VTK_STEREO_LEFT 4
66 #define VTK_STEREO_RIGHT 5
67 #define VTK_STEREO_DRESDEN 6
68 #define VTK_STEREO_ANAGLYPH 7
69 #define VTK_STEREO_CHECKERBOARD 8
70 
71 #define VTK_CURSOR_DEFAULT 0
72 #define VTK_CURSOR_ARROW 1
73 #define VTK_CURSOR_SIZENE 2
74 #define VTK_CURSOR_SIZENW 3
75 #define VTK_CURSOR_SIZESW 4
76 #define VTK_CURSOR_SIZESE 5
77 #define VTK_CURSOR_SIZENS 6
78 #define VTK_CURSOR_SIZEWE 7
79 #define VTK_CURSOR_SIZEALL 8
80 #define VTK_CURSOR_HAND 9
81 #define VTK_CURSOR_CROSSHAIR 10
82 
84 
91 #ifdef VTK_LEAN_AND_MEAN
92 # define vtkGraphicErrorMacro(renderWindow,message)
93 #else
94 # define vtkGraphicErrorMacro(renderWindow,message) \
95  if(renderWindow->GetReportGraphicErrors()) \
96  { \
97  renderWindow->CheckGraphicError(); \
98  if(renderWindow->HasGraphicError()) \
99  { \
100  vtkErrorMacro(<<message<<" "<<renderWindow->GetLastGraphicErrorString()); \
101  } \
102  }
103 #endif
104 
105 
107 {
108 public:
109  vtkTypeMacro(vtkRenderWindow,vtkWindow);
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 
134  virtual void Render();
135 
137  virtual void Start() = 0;
138 
140  virtual void Finalize() = 0;
141 
144  virtual void Frame() = 0;
145 
148  virtual void WaitForCompletion()=0;
149 
152  virtual void CopyResultFrame();
153 
157  virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor();
158 
160 
163  virtual void HideCursor() = 0;
164  virtual void ShowCursor() = 0;
165  virtual void SetCursorPosition(int , int ) {};
167 
169 
170  vtkSetMacro(CurrentCursor,int);
171  vtkGetMacro(CurrentCursor,int);
173 
175 
176  virtual void SetFullScreen(int) = 0;
177  vtkGetMacro(FullScreen,int);
178  vtkBooleanMacro(FullScreen,int);
180 
182 
185  vtkSetMacro(Borders,int);
186  vtkGetMacro(Borders,int);
187  vtkBooleanMacro(Borders,int);
189 
191 
193  vtkGetMacro(StereoCapableWindow,int);
194  vtkBooleanMacro(StereoCapableWindow,int);
195  virtual void SetStereoCapableWindow(int capable);
197 
199 
200  vtkGetMacro(StereoRender,int);
201  void SetStereoRender(int stereo);
202  vtkBooleanMacro(StereoRender,int);
204 
206 
207  vtkSetMacro(AlphaBitPlanes, int);
208  vtkGetMacro(AlphaBitPlanes, int);
209  vtkBooleanMacro(AlphaBitPlanes, int);
211 
213 
215  vtkSetMacro(PointSmoothing,int);
216  vtkGetMacro(PointSmoothing,int);
217  vtkBooleanMacro(PointSmoothing,int);
219 
221 
223  vtkSetMacro(LineSmoothing,int);
224  vtkGetMacro(LineSmoothing,int);
225  vtkBooleanMacro(LineSmoothing,int);
227 
229 
231  vtkSetMacro(PolygonSmoothing,int);
232  vtkGetMacro(PolygonSmoothing,int);
233  vtkBooleanMacro(PolygonSmoothing,int);
235 
237 
249  vtkGetMacro(StereoType,int);
250  vtkSetMacro(StereoType,int);
251  void SetStereoTypeToCrystalEyes()
252  {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);}
253  void SetStereoTypeToRedBlue()
254  {this->SetStereoType(VTK_STEREO_RED_BLUE);}
255  void SetStereoTypeToInterlaced()
256  {this->SetStereoType(VTK_STEREO_INTERLACED);}
257  void SetStereoTypeToLeft()
258  {this->SetStereoType(VTK_STEREO_LEFT);}
259  void SetStereoTypeToRight()
260  {this->SetStereoType(VTK_STEREO_RIGHT);}
261  void SetStereoTypeToDresden()
262  {this->SetStereoType(VTK_STEREO_DRESDEN);}
263  void SetStereoTypeToAnaglyph()
264  {this->SetStereoType(VTK_STEREO_ANAGLYPH);}
265  void SetStereoTypeToCheckerboard()
266  {this->SetStereoType(VTK_STEREO_CHECKERBOARD);}
268 
269  const char *GetStereoTypeAsString();
270 
274  virtual void StereoUpdate();
275 
278  virtual void StereoMidpoint();
279 
282  virtual void StereoRenderComplete();
283 
285 
290  vtkSetClampMacro(AnaglyphColorSaturation,float, 0.0f, 1.0f);
291  vtkGetMacro(AnaglyphColorSaturation,float);
293 
295 
306  vtkSetVector2Macro(AnaglyphColorMask,int);
307  vtkGetVectorMacro(AnaglyphColorMask,int,2);
309 
313  virtual void WindowRemap() = 0;
314 
316 
317  vtkSetMacro(SwapBuffers,int);
318  vtkGetMacro(SwapBuffers,int);
319  vtkBooleanMacro(SwapBuffers,int);
321 
323 
332  virtual int SetPixelData(int x, int y, int x2, int y2, unsigned char *data,
333  int front) = 0;
334  virtual int SetPixelData(int x, int y, int x2, int y2,
335  vtkUnsignedCharArray *data, int front) = 0;
337 
339 
344  virtual float *GetRGBAPixelData(int x, int y, int x2, int y2, int front) = 0;
345  virtual int GetRGBAPixelData(int x, int y, int x2, int y2, int front,
346  vtkFloatArray *data) = 0;
347  virtual int SetRGBAPixelData(int x, int y, int x2, int y2, float *,
348  int front, int blend=0) = 0;
349  virtual int SetRGBAPixelData(int, int, int, int, vtkFloatArray*,
350  int, int blend=0) = 0;
351  virtual void ReleaseRGBAPixelData(float *data)=0;
352  virtual unsigned char *GetRGBACharPixelData(int x, int y, int x2, int y2,
353  int front) = 0;
354  virtual int GetRGBACharPixelData(int x, int y, int x2, int y2, int front,
356  virtual int SetRGBACharPixelData(int x,int y, int x2, int y2,
357  unsigned char *data, int front,
358  int blend=0) = 0;
359  virtual int SetRGBACharPixelData(int x, int y, int x2, int y2,
360  vtkUnsignedCharArray *data, int front,
361  int blend=0) = 0;
363 
365 
367  virtual float *GetZbufferData(int x, int y, int x2, int y2) = 0;
368  virtual int GetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
369  virtual int GetZbufferData(int x, int y, int x2, int y2,
370  vtkFloatArray *z) = 0;
371  virtual int SetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
372  virtual int SetZbufferData(int x, int y, int x2, int y2,
373  vtkFloatArray *z) = 0;
374  float GetZbufferDataAtPoint(int x, int y)
375  {
376  float value;
377  this->GetZbufferData(x, y, x, y, &value);
378  return value;
379  }
381 
383 
386  vtkGetMacro(AAFrames,int);
387  vtkSetMacro(AAFrames,int);
389 
391 
396  vtkGetMacro(FDFrames,int);
397  vtkSetMacro(FDFrames,int);
399 
401 
407  vtkGetMacro(SubFrames,int);
408  virtual void SetSubFrames(int subFrames);
410 
412 
413  vtkGetMacro(NeverRendered,int);
415 
417 
419  vtkGetMacro(AbortRender,int);
420  vtkSetMacro(AbortRender,int);
421  vtkGetMacro(InAbortCheck,int);
422  vtkSetMacro(InAbortCheck,int);
423  virtual int CheckAbortStatus();
425 
426  vtkGetMacro(IsPicking,int);
427  vtkSetMacro(IsPicking,int);
428  vtkBooleanMacro(IsPicking,int);
429 
434  virtual int GetEventPending() = 0;
435 
437  virtual int CheckInRenderStatus() { return this->InRender; }
438 
440  virtual void ClearInRenderStatus() { this->InRender = 0; }
441 
443 
448  virtual void SetDesiredUpdateRate(double);
449  vtkGetMacro(DesiredUpdateRate,double);
451 
453 
457  vtkGetMacro(NumberOfLayers, int);
458  vtkSetClampMacro(NumberOfLayers, int, 1, VTK_LARGE_INTEGER);
460 
462 
463  vtkGetObjectMacro(Interactor,vtkRenderWindowInteractor);
465 
467  void SetInteractor(vtkRenderWindowInteractor *);
468 
471  virtual void UnRegister(vtkObjectBase *o);
472 
474 
475  virtual void SetDisplayId(void *) = 0;
476  virtual void SetWindowId(void *) = 0;
477  virtual void SetNextWindowId(void *) = 0;
478  virtual void SetParentId(void *) = 0;
479  virtual void *GetGenericDisplayId() = 0;
480  virtual void *GetGenericWindowId() = 0;
481  virtual void *GetGenericParentId() = 0;
482  virtual void *GetGenericContext() = 0;
483  virtual void *GetGenericDrawable() = 0;
484  virtual void SetWindowInfo(char *) = 0;
485  virtual void SetNextWindowInfo(char *) = 0;
486  virtual void SetParentInfo(char *) = 0;
488 
491  virtual void MakeCurrent() = 0;
492 
495  virtual bool IsCurrent()=0;
496 
500  virtual void SetForceMakeCurrent() {};
501 
503  virtual const char *ReportCapabilities() { return "Not Implemented";};
504 
506  virtual int SupportsOpenGL() { return 0;};
507 
509  virtual int IsDirect() { return 0;};
510 
513  virtual int GetDepthBufferSize() = 0;
514 
517  virtual int GetColorBufferSizes(int *rgba) = 0;
518 
520 
522  vtkGetObjectMacro(PainterDeviceAdapter, vtkPainterDeviceAdapter);
524 
526 
528  vtkSetMacro(MultiSamples,int);
529  vtkGetMacro(MultiSamples,int);
531 
533 
534  vtkSetMacro(StencilCapable, int);
535  vtkGetMacro(StencilCapable, int);
536  vtkBooleanMacro(StencilCapable, int);
538 
540 
542  vtkSetMacro(ReportGraphicErrors,int);
543  vtkGetMacro(ReportGraphicErrors,int);
544  vtkBooleanMacro(ReportGraphicErrors,int);
546 
550  virtual void CheckGraphicError()=0;
551 
553  virtual int HasGraphicError()=0;
554 
556  virtual const char *GetLastGraphicErrorString()=0;
557 
558 protected:
559  vtkRenderWindow();
560  ~vtkRenderWindow();
561 
562  virtual void DoStereoRender();
563  virtual void DoFDRender();
564  virtual void DoAARender();
565 
568  int Borders;
570  int OldScreen[5];
576  int StereoStatus; // used for keeping track of what's going on
580  unsigned char* StereoBuffer; // used for red blue stereo
581  float *AccumulationBuffer; // used for many techniques
583  int AAFrames;
584  int FDFrames;
585  int SubFrames; // number of sub frames
586  int CurrentSubFrame; // what one are we on
587  unsigned char *ResultFrame; // used for any non immediate rendering
592  int InRender;
598  int AnaglyphColorMask[2];
601 
605 
608 
609 private:
610  vtkRenderWindow(const vtkRenderWindow&); // Not implemented.
611  void operator=(const vtkRenderWindow&); // Not implemented.
612 };
613 
614 #endif