00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00049 #ifndef __vtkRenderWindow_h
00050 #define __vtkRenderWindow_h
00051
00052 #include "vtkWindow.h"
00053
00054 class vtkFloatArray;
00055 class vtkPainterDeviceAdapter;
00056 class vtkRenderWindowInteractor;
00057 class vtkRenderer;
00058 class vtkRendererCollection;
00059 class vtkUnsignedCharArray;
00060
00061
00062 #define VTK_STEREO_CRYSTAL_EYES 1
00063 #define VTK_STEREO_RED_BLUE 2
00064 #define VTK_STEREO_INTERLACED 3
00065 #define VTK_STEREO_LEFT 4
00066 #define VTK_STEREO_RIGHT 5
00067 #define VTK_STEREO_DRESDEN 6
00068 #define VTK_STEREO_ANAGLYPH 7
00069
00070 #define VTK_CURSOR_DEFAULT 0
00071 #define VTK_CURSOR_ARROW 1
00072 #define VTK_CURSOR_SIZENE 2
00073 #define VTK_CURSOR_SIZENW 3
00074 #define VTK_CURSOR_SIZESW 4
00075 #define VTK_CURSOR_SIZESE 5
00076 #define VTK_CURSOR_SIZENS 6
00077 #define VTK_CURSOR_SIZEWE 7
00078 #define VTK_CURSOR_SIZEALL 8
00079 #define VTK_CURSOR_HAND 9
00080 #define VTK_CURSOR_CROSSHAIR 10
00081
00083
00090 #ifdef VTK_LEAN_AND_MEAN
00091 # define vtkGraphicErrorMacro(renderWindow,message)
00092
00093 #else
00094 # define vtkGraphicErrorMacro(renderWindow,message) \
00095 if(renderWindow->GetReportGraphicErrors()) \
00096 { \
00097 renderWindow->CheckGraphicError(); \
00098 if(renderWindow->HasGraphicError()) \
00099 { \
00100 vtkErrorMacro(<<message<<" "<<renderWindow->GetLastGraphicErrorString()); \
00101 } \
00102 }
00103 #endif
00104
00105 class VTK_RENDERING_EXPORT vtkRenderWindow : public vtkWindow
00106 {
00107 public:
00108 vtkTypeRevisionMacro(vtkRenderWindow,vtkWindow);
00109 void PrintSelf(ostream& os, vtkIndent indent);
00110
00114 static vtkRenderWindow *New();
00115
00117 virtual void AddRenderer(vtkRenderer *);
00118
00120 void RemoveRenderer(vtkRenderer *);
00121
00123 int HasRenderer(vtkRenderer *);
00124
00126 static const char *GetRenderLibrary();
00127
00129 vtkRendererCollection *GetRenderers() {return this->Renderers;};
00130
00133 virtual void Render();
00134
00136 virtual void Start() = 0;
00137
00139 virtual void Finalize() = 0;
00140
00143 virtual void Frame() = 0;
00144
00147 virtual void CopyResultFrame();
00148
00152 virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor();
00153
00155
00158 virtual void HideCursor() = 0;
00159 virtual void ShowCursor() = 0;
00160 virtual void SetCursorPosition(int , int ) {};
00162
00164
00165 vtkSetMacro(CurrentCursor,int);
00166 vtkGetMacro(CurrentCursor,int);
00168
00170
00171 virtual void SetFullScreen(int) = 0;
00172 vtkGetMacro(FullScreen,int);
00173 vtkBooleanMacro(FullScreen,int);
00175
00177
00180 vtkSetMacro(Borders,int);
00181 vtkGetMacro(Borders,int);
00182 vtkBooleanMacro(Borders,int);
00184
00186
00188 vtkGetMacro(StereoCapableWindow,int);
00189 vtkBooleanMacro(StereoCapableWindow,int);
00190 virtual void SetStereoCapableWindow(int capable);
00192
00194
00195 vtkGetMacro(StereoRender,int);
00196 void SetStereoRender(int stereo);
00197 vtkBooleanMacro(StereoRender,int);
00199
00201
00202 vtkSetMacro(AlphaBitPlanes, int);
00203 vtkGetMacro(AlphaBitPlanes, int);
00204 vtkBooleanMacro(AlphaBitPlanes, int);
00206
00208
00210 vtkSetMacro(PointSmoothing,int);
00211 vtkGetMacro(PointSmoothing,int);
00212 vtkBooleanMacro(PointSmoothing,int);
00214
00216
00218 vtkSetMacro(LineSmoothing,int);
00219 vtkGetMacro(LineSmoothing,int);
00220 vtkBooleanMacro(LineSmoothing,int);
00222
00224
00226 vtkSetMacro(PolygonSmoothing,int);
00227 vtkGetMacro(PolygonSmoothing,int);
00228 vtkBooleanMacro(PolygonSmoothing,int);
00230
00232
00244 vtkGetMacro(StereoType,int);
00245 vtkSetMacro(StereoType,int);
00246 void SetStereoTypeToCrystalEyes()
00247 {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);}
00248 void SetStereoTypeToRedBlue()
00249 {this->SetStereoType(VTK_STEREO_RED_BLUE);}
00250 void SetStereoTypeToInterlaced()
00251 {this->SetStereoType(VTK_STEREO_INTERLACED);}
00252 void SetStereoTypeToLeft()
00253 {this->SetStereoType(VTK_STEREO_LEFT);}
00254 void SetStereoTypeToRight()
00255 {this->SetStereoType(VTK_STEREO_RIGHT);}
00256 void SetStereoTypeToDresden()
00257 {this->SetStereoType(VTK_STEREO_DRESDEN);}
00258 void SetStereoTypeToAnaglyph()
00259 {this->SetStereoType(VTK_STEREO_ANAGLYPH);}
00260 const char *GetStereoTypeAsString();
00262
00266 virtual void StereoUpdate();
00267
00270 virtual void StereoMidpoint();
00271
00274 virtual void StereoRenderComplete();
00275
00277
00282 vtkSetClampMacro(AnaglyphColorSaturation,float, 0.0f, 1.0f);
00283 vtkGetMacro(AnaglyphColorSaturation,float);
00285
00287
00298 vtkSetVector2Macro(AnaglyphColorMask,int);
00299 vtkGetVectorMacro(AnaglyphColorMask,int,2);
00301
00305 virtual void WindowRemap() = 0;
00306
00308
00309 vtkSetMacro(SwapBuffers,int);
00310 vtkGetMacro(SwapBuffers,int);
00311 vtkBooleanMacro(SwapBuffers,int);
00313
00315
00324 virtual int SetPixelData(int x, int y, int x2, int y2, unsigned char *data,
00325 int front) = 0;
00326 virtual int SetPixelData(int x, int y, int x2, int y2,
00327 vtkUnsignedCharArray *data, int front) = 0;
00329
00331
00336 virtual float *GetRGBAPixelData(int x, int y, int x2, int y2, int front) = 0;
00337 virtual int GetRGBAPixelData(int x, int y, int x2, int y2, int front,
00338 vtkFloatArray *data) = 0;
00339 virtual int SetRGBAPixelData(int x, int y, int x2, int y2, float *,
00340 int front, int blend=0) = 0;
00341 virtual int SetRGBAPixelData(int, int, int, int, vtkFloatArray*,
00342 int, int blend=0) = 0;
00343 virtual void ReleaseRGBAPixelData(float *data)=0;
00344 virtual unsigned char *GetRGBACharPixelData(int x, int y, int x2, int y2,
00345 int front) = 0;
00346 virtual int GetRGBACharPixelData(int x, int y, int x2, int y2, int front,
00347 vtkUnsignedCharArray *data) = 0;
00348 virtual int SetRGBACharPixelData(int x,int y, int x2, int y2,
00349 unsigned char *data, int front,
00350 int blend=0) = 0;
00351 virtual int SetRGBACharPixelData(int x, int y, int x2, int y2,
00352 vtkUnsignedCharArray *data, int front,
00353 int blend=0) = 0;
00355
00357
00359 virtual float *GetZbufferData(int x, int y, int x2, int y2) = 0;
00360 virtual int GetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
00361 virtual int GetZbufferData(int x, int y, int x2, int y2,
00362 vtkFloatArray *z) = 0;
00363 virtual int SetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
00364 virtual int SetZbufferData(int x, int y, int x2, int y2,
00365 vtkFloatArray *z) = 0;
00366 float GetZbufferDataAtPoint(int x, int y)
00367 {
00368 float value;
00369 this->GetZbufferData(x, y, x, y, &value);
00370 return value;
00371 }
00373
00375
00378 vtkGetMacro(AAFrames,int);
00379 vtkSetMacro(AAFrames,int);
00381
00383
00388 vtkGetMacro(FDFrames,int);
00389 vtkSetMacro(FDFrames,int);
00391
00393
00399 vtkGetMacro(SubFrames,int);
00400 virtual void SetSubFrames(int subFrames);
00402
00404
00405 vtkGetMacro(NeverRendered,int);
00407
00409
00411 vtkGetMacro(AbortRender,int);
00412 vtkSetMacro(AbortRender,int);
00413 vtkGetMacro(InAbortCheck,int);
00414 vtkSetMacro(InAbortCheck,int);
00415 virtual int CheckAbortStatus();
00417
00418 vtkGetMacro(IsPicking,int);
00419 vtkSetMacro(IsPicking,int);
00420 vtkBooleanMacro(IsPicking,int);
00421
00426 virtual int GetEventPending() = 0;
00427
00429 virtual int CheckInRenderStatus() { return this->InRender; }
00430
00432 virtual void ClearInRenderStatus() { this->InRender = 0; }
00433
00435
00440 virtual void SetDesiredUpdateRate(double);
00441 vtkGetMacro(DesiredUpdateRate,double);
00443
00445
00449 vtkGetMacro(NumberOfLayers, int);
00450 vtkSetClampMacro(NumberOfLayers, int, 1, VTK_LARGE_INTEGER);
00452
00454
00455 vtkGetObjectMacro(Interactor,vtkRenderWindowInteractor);
00457
00459 void SetInteractor(vtkRenderWindowInteractor *);
00460
00463 virtual void UnRegister(vtkObjectBase *o);
00464
00466
00467 virtual void SetDisplayId(void *) = 0;
00468 virtual void SetWindowId(void *) = 0;
00469 virtual void SetNextWindowId(void *) = 0;
00470 virtual void SetParentId(void *) = 0;
00471 virtual void *GetGenericDisplayId() = 0;
00472 virtual void *GetGenericWindowId() = 0;
00473 virtual void *GetGenericParentId() = 0;
00474 virtual void *GetGenericContext() = 0;
00475 virtual void *GetGenericDrawable() = 0;
00476 virtual void SetWindowInfo(char *) = 0;
00477 virtual void SetNextWindowInfo(char *) = 0;
00478 virtual void SetParentInfo(char *) = 0;
00480
00482 virtual void MakeCurrent() = 0;
00483
00487 virtual void SetForceMakeCurrent() {};
00488
00490 virtual const char *ReportCapabilities() { return "Not Implemented";};
00491
00493 virtual int SupportsOpenGL() { return 0;};
00494
00496 virtual int IsDirect() { return 0;};
00497
00500 virtual int GetDepthBufferSize() = 0;
00501
00504 virtual int GetColorBufferSizes(int *rgba) = 0;
00505
00507
00509 vtkGetObjectMacro(PainterDeviceAdapter, vtkPainterDeviceAdapter);
00511
00513
00515 vtkSetMacro(MultiSamples,int);
00516 vtkGetMacro(MultiSamples,int);
00518
00520
00521 vtkSetMacro(StencilCapable, int);
00522 vtkGetMacro(StencilCapable, int);
00523 vtkBooleanMacro(StencilCapable, int);
00525
00527
00529 vtkSetMacro(ReportGraphicErrors,int);
00530 vtkGetMacro(ReportGraphicErrors,int);
00531 vtkBooleanMacro(ReportGraphicErrors,int);
00533
00537 virtual void CheckGraphicError()=0;
00538
00540 virtual int HasGraphicError()=0;
00541
00543 virtual const char *GetLastGraphicErrorString()=0;
00544
00545 protected:
00546 vtkRenderWindow();
00547 ~vtkRenderWindow();
00548
00549 virtual void DoStereoRender();
00550 virtual void DoFDRender();
00551 virtual void DoAARender();
00552
00553 vtkPainterDeviceAdapter* PainterDeviceAdapter;
00554 vtkRendererCollection *Renderers;
00555 int Borders;
00556 int FullScreen;
00557 int OldScreen[5];
00558 int PointSmoothing;
00559 int LineSmoothing;
00560 int PolygonSmoothing;
00561 int StereoRender;
00562 int StereoType;
00563 int StereoStatus;
00564 int StereoCapableWindow;
00565 int AlphaBitPlanes;
00566 vtkRenderWindowInteractor *Interactor;
00567 unsigned char* StereoBuffer;
00568 float *AccumulationBuffer;
00569 unsigned int AccumulationBufferSize;
00570 int AAFrames;
00571 int FDFrames;
00572 int SubFrames;
00573 int CurrentSubFrame;
00574 unsigned char *ResultFrame;
00575 int SwapBuffers;
00576 double DesiredUpdateRate;
00577 int AbortRender;
00578 int InAbortCheck;
00579 int InRender;
00580 int NeverRendered;
00581 int NumberOfLayers;
00582 int CurrentCursor;
00583 int IsPicking;
00584 float AnaglyphColorSaturation;
00585 int AnaglyphColorMask[2];
00586 int MultiSamples;
00587 int StencilCapable;
00588
00591 int ReportGraphicErrors;
00592
00594 double AbortCheckTime;
00595
00596 private:
00597 vtkRenderWindow(const vtkRenderWindow&);
00598 void operator=(const vtkRenderWindow&);
00599 };
00600
00601 #endif