Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkRenderWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkRenderWindow.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00061 #ifndef __vtkRenderWindow_h
00062 #define __vtkRenderWindow_h
00063 
00064 #include "vtkWindow.h"
00065 
00066 class vtkFloatArray;
00067 class vtkRenderWindowInteractor;
00068 class vtkRenderer;
00069 class vtkRendererCollection;
00070 class vtkUnsignedCharArray;
00071 
00072 // lets define the different types of stereo
00073 #define VTK_STEREO_CRYSTAL_EYES 1
00074 #define VTK_STEREO_RED_BLUE     2
00075 #define VTK_STEREO_INTERLACED   3
00076 #define VTK_STEREO_LEFT         4
00077 #define VTK_STEREO_RIGHT        5
00078 #define VTK_STEREO_DRESDEN      6
00079 #define VTK_STEREO_ANAGLYPH     7
00080 
00081 #define VTK_CURSOR_DEFAULT  0
00082 #define VTK_CURSOR_ARROW    1
00083 #define VTK_CURSOR_SIZENE   2
00084 #define VTK_CURSOR_SIZENW   3
00085 #define VTK_CURSOR_SIZESW   4
00086 #define VTK_CURSOR_SIZESE   5
00087 #define VTK_CURSOR_SIZENS   6
00088 #define VTK_CURSOR_SIZEWE   7
00089 #define VTK_CURSOR_SIZEALL  8
00090 #define VTK_CURSOR_HAND     9
00091 
00092 class VTK_RENDERING_EXPORT vtkRenderWindow : public vtkWindow
00093 {
00094 public:
00095   vtkTypeRevisionMacro(vtkRenderWindow,vtkWindow);
00096   void PrintSelf(ostream& os, vtkIndent indent);
00097 
00101   static vtkRenderWindow *New();
00102 
00104   virtual void AddRenderer(vtkRenderer *);
00105 
00107   void RemoveRenderer(vtkRenderer *);
00108 
00110   static const char *GetRenderLibrary();
00111 
00113   vtkRendererCollection *GetRenderers() {return this->Renderers;};
00114 
00117   virtual void Render();
00118 
00120   virtual void Start() = 0;
00121   
00124   virtual void Frame() = 0;
00125 
00128   virtual void CopyResultFrame();
00129 
00133   virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor();
00134 
00136 
00139   virtual void HideCursor() = 0;
00140   virtual void ShowCursor() = 0;
00141   virtual void SetCursorPosition(int , int ) {};
00143 
00145 
00146   vtkSetMacro(CurrentCursor,int);
00147   vtkGetMacro(CurrentCursor,int);
00149 
00151 
00152   virtual void SetFullScreen(int) = 0;
00153   vtkGetMacro(FullScreen,int);
00154   vtkBooleanMacro(FullScreen,int);
00156 
00158 
00161   vtkSetMacro(Borders,int);
00162   vtkGetMacro(Borders,int);
00163   vtkBooleanMacro(Borders,int);
00165 
00167 
00169   vtkGetMacro(StereoCapableWindow,int);
00170   vtkBooleanMacro(StereoCapableWindow,int);
00171   virtual void SetStereoCapableWindow(int capable);
00173 
00175 
00176   vtkGetMacro(StereoRender,int);
00177   void SetStereoRender(int stereo);
00178   vtkBooleanMacro(StereoRender,int);
00180 
00182 
00183   vtkSetMacro(AlphaBitPlanes, int);
00184   vtkGetMacro(AlphaBitPlanes, int);
00185   vtkBooleanMacro(AlphaBitPlanes, int);
00187   
00189 
00191   vtkSetMacro(PointSmoothing,int);
00192   vtkGetMacro(PointSmoothing,int);
00193   vtkBooleanMacro(PointSmoothing,int);
00195 
00197 
00199   vtkSetMacro(LineSmoothing,int);
00200   vtkGetMacro(LineSmoothing,int);
00201   vtkBooleanMacro(LineSmoothing,int);
00203 
00205 
00207   vtkSetMacro(PolygonSmoothing,int);
00208   vtkGetMacro(PolygonSmoothing,int);
00209   vtkBooleanMacro(PolygonSmoothing,int);
00211 
00213 
00225   vtkGetMacro(StereoType,int);
00226   vtkSetMacro(StereoType,int);
00227   void SetStereoTypeToCrystalEyes() 
00228     {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);};
00229   void SetStereoTypeToRedBlue() 
00230     {this->SetStereoType(VTK_STEREO_RED_BLUE);};
00231   void SetStereoTypeToInterlaced() 
00232     {this->SetStereoType(VTK_STEREO_INTERLACED);};
00233   void SetStereoTypeToLeft() 
00234     {this->SetStereoType(VTK_STEREO_LEFT);};
00235   void SetStereoTypeToRight() 
00236     {this->SetStereoType(VTK_STEREO_RIGHT);};
00237   void SetStereoTypeToDresden() 
00238     {this->SetStereoType(VTK_STEREO_DRESDEN);};  
00239   void SetStereoTypeToAnaglyph() 
00240     {this->SetStereoType(VTK_STEREO_ANAGLYPH);};
00241   char *GetStereoTypeAsString();
00243 
00247   virtual void StereoUpdate();
00248 
00251   virtual void StereoMidpoint();
00252 
00255   virtual void StereoRenderComplete();
00256 
00258 
00263   vtkSetClampMacro(AnaglyphColorSaturation,float, 0.0, 1.0);
00264   vtkGetMacro(AnaglyphColorSaturation,float);
00266 
00268 
00279   vtkSetVector2Macro(AnaglyphColorMask,int);
00280   vtkGetVectorMacro(AnaglyphColorMask,int,2);
00282 
00286   virtual void WindowRemap() = 0;
00287   
00289 
00290   vtkSetMacro(SwapBuffers,int);
00291   vtkGetMacro(SwapBuffers,int);
00292   vtkBooleanMacro(SwapBuffers,int);
00294   
00296 
00304   virtual int SetPixelData(int, int, int, int, unsigned char *,int) = 0;
00305   virtual int SetPixelData(int, int, int, int, vtkUnsignedCharArray*,
00306                            int ) = 0;
00308 
00310 
00315   virtual float *GetRGBAPixelData(int ,int ,int ,int ,int ) = 0;
00316   virtual int GetRGBAPixelData(int, int, int, int, int, vtkFloatArray* ) = 0;
00317   virtual int SetRGBAPixelData(int ,int ,int ,int ,float *,int,
00318                                int blend=0) = 0;
00319   virtual int SetRGBAPixelData(int, int, int, int, vtkFloatArray*,
00320                                int, int blend=0) = 0;
00321   virtual void ReleaseRGBAPixelData(float *data)=0;
00322   virtual unsigned char *GetRGBACharPixelData(int ,int ,int ,int ,int ) = 0;
00323   virtual int GetRGBACharPixelData(int ,int, int, int, int,
00324                                    vtkUnsignedCharArray*) = 0;
00325   virtual int SetRGBACharPixelData(int ,int ,int ,int ,unsigned char *, int,
00326                                    int blend=0) = 0;
00327   virtual int SetRGBACharPixelData(int, int, int, int,
00328                                    vtkUnsignedCharArray *,
00329                                    int, int blend=0) = 0;
00331 
00333 
00334   virtual float *GetZbufferData(int, int, int, int ) = 0;
00335   virtual int GetZbufferData( int, int, int, int, vtkFloatArray*) = 0;
00336   virtual int SetZbufferData(int, int, int, int, float *) = 0;
00337   virtual int SetZbufferData( int, int, int, int, vtkFloatArray * ) = 0;
00339 
00341 
00344   vtkGetMacro(AAFrames,int);
00345   vtkSetMacro(AAFrames,int);
00347 
00349 
00354   vtkGetMacro(FDFrames,int);
00355   vtkSetMacro(FDFrames,int);
00357 
00359 
00365   vtkGetMacro(SubFrames,int);
00366   virtual void SetSubFrames(int subFrames);
00368 
00370 
00371   vtkGetMacro(NeverRendered,int);
00373 
00375 
00377   vtkGetMacro(AbortRender,int);
00378   vtkSetMacro(AbortRender,int);
00379   vtkGetMacro(InAbortCheck,int);
00380   vtkSetMacro(InAbortCheck,int);
00381   virtual int CheckAbortStatus();
00383 
00384   vtkGetMacro(IsPicking,int);
00385   vtkSetMacro(IsPicking,int);
00386   vtkBooleanMacro(IsPicking,int);
00387   
00392   virtual int GetEventPending() = 0;
00393 
00395   virtual int  CheckInRenderStatus() { return this->InRender; }
00396 
00398   virtual void ClearInRenderStatus() { this->InRender = 0; }
00399 
00401 
00406   void SetDesiredUpdateRate(double);
00407   vtkGetMacro(DesiredUpdateRate,double);
00409 
00411 
00415   vtkGetMacro(NumberOfLayers, int);
00416   vtkSetClampMacro(NumberOfLayers, int, 1, VTK_LARGE_INTEGER);
00418 
00420 
00421   vtkGetObjectMacro(Interactor,vtkRenderWindowInteractor);
00423 
00425   void SetInteractor(vtkRenderWindowInteractor *);
00426 
00429   virtual void UnRegister(vtkObjectBase *o);
00430   
00432 
00433   virtual void SetDisplayId(void *) = 0;
00434   virtual void SetWindowId(void *)  = 0;
00435   virtual void SetNextWindowId(void *) = 0;
00436   virtual void SetParentId(void *)  = 0;
00437   virtual void *GetGenericDisplayId() = 0;
00438   virtual void *GetGenericWindowId() = 0;
00439   virtual void *GetGenericParentId() = 0;
00440   virtual void *GetGenericContext() = 0;
00441   virtual void *GetGenericDrawable() = 0;
00442   virtual void SetWindowInfo(char *) = 0;
00443   virtual void SetNextWindowInfo(char *) = 0;
00444   virtual void SetParentInfo(char *) = 0;
00446 
00448   virtual void MakeCurrent() = 0;
00449 
00453   virtual void SetForceMakeCurrent() {};
00454 
00456   virtual const char *ReportCapabilities() { return "Not Implemented";};
00457 
00459   virtual int SupportsOpenGL() { return 0;};
00460 
00462   virtual int IsDirect() { return 0;};
00463 
00466   virtual int GetDepthBufferSize() = 0;
00467 
00468 protected:
00469   vtkRenderWindow();
00470   ~vtkRenderWindow();
00471 
00472   virtual void DoStereoRender();
00473   virtual void DoFDRender();
00474   virtual void DoAARender();
00475 
00476   vtkRendererCollection *Renderers;
00477   int Borders;
00478   int FullScreen;
00479   int OldScreen[5];
00480   int PointSmoothing;
00481   int LineSmoothing;
00482   int PolygonSmoothing;
00483   int StereoRender;
00484   int StereoType;
00485   int StereoStatus; // used for keeping track of what's going on
00486   int StereoCapableWindow;
00487   int AlphaBitPlanes;
00488   vtkRenderWindowInteractor *Interactor;
00489   unsigned char* StereoBuffer; // used for red blue stereo
00490   float *AccumulationBuffer;   // used for many techniques
00491   unsigned int AccumulationBufferSize;
00492   int AAFrames;
00493   int FDFrames;
00494   int SubFrames;               // number of sub frames
00495   int CurrentSubFrame;         // what one are we on
00496   unsigned char *ResultFrame;  // used for any non immediate rendering
00497   int   SwapBuffers;
00498   double DesiredUpdateRate;
00499   int   AbortRender;
00500   int   InAbortCheck;
00501   int   InRender;
00502   int   NeverRendered;
00503   int   NumberOfLayers;
00504   int CurrentCursor;
00505   int IsPicking;
00506   float AnaglyphColorSaturation;
00507   int AnaglyphColorMask[2];
00508 
00509 private:
00510   vtkRenderWindow(const vtkRenderWindow&);  // Not implemented.
00511   void operator=(const vtkRenderWindow&);  // Not implemented.
00512 };
00513 
00515 inline char *vtkRenderWindow::GetStereoTypeAsString(void)
00516 {
00517   switch ( this->StereoType )
00518     {
00519     case VTK_STEREO_CRYSTAL_EYES:
00520       return (char *)"CrystalEyes";
00521     case VTK_STEREO_RED_BLUE:
00522       return (char *)"RedBlue";
00523     case VTK_STEREO_LEFT:
00524       return (char *)"Left";
00525     case VTK_STEREO_RIGHT:
00526       return (char *)"Right";
00527     case VTK_STEREO_DRESDEN:
00528       return (char *)"DresdenDisplay";
00529     case VTK_STEREO_ANAGLYPH:
00530       return (char *)"Anaglyph";
00531     default:
00532       return (char *)"";
00533     }
00534 }
00535 
00536 #endif