Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Rendering/vtkRenderWindow.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkRenderWindow.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00065 #ifndef __vtkRenderWindow_h
    00066 #define __vtkRenderWindow_h
    00067
    00068 #include "vtkWindow.h"
    00069
    00070 class vtkFloatArray;
    00071 class vtkRenderWindowInteractor;
    00072 class vtkRenderer;
    00073 class vtkRendererCollection;
    00074 class vtkUnsignedCharArray;
    00075
    00076 // lets define the different types of stereo
    00077 #define VTK_STEREO_CRYSTAL_EYES 1
    00078 #define VTK_STEREO_RED_BLUE     2
    00079 #define VTK_STEREO_INTERLACED   3
    00080 #define VTK_STEREO_LEFT         4
    00081 #define VTK_STEREO_RIGHT        5
    00082 #define VTK_STEREO_DRESDEN      6
    00083
    00084 #define VTK_CURSOR_DEFAULT  0
    00085 #define VTK_CURSOR_ARROW    1
    00086 #define VTK_CURSOR_SIZENE   2
    00087 #define VTK_CURSOR_SIZENW   3
    00088 #define VTK_CURSOR_SIZESW   4
    00089 #define VTK_CURSOR_SIZESE   5
    00090 #define VTK_CURSOR_SIZENS   6
    00091 #define VTK_CURSOR_SIZEWE   7
    00092 #define VTK_CURSOR_SIZEALL  8
    00093 #define VTK_CURSOR_HAND     9
    00094
    00095 class VTK_RENDERING_EXPORT vtkRenderWindow : public vtkWindow
    00096 {
    00097 public:
    00098   vtkTypeRevisionMacro(vtkRenderWindow,vtkWindow);
    00099   void PrintSelf(ostream& os, vtkIndent indent);
    00100
    00104   static vtkRenderWindow *New();
    00105
    00107   virtual void AddRenderer(vtkRenderer *);
    00108
    00110   void RemoveRenderer(vtkRenderer *);
    00111
    00113   static const char *GetRenderLibrary();
    00114
    00116   vtkRendererCollection *GetRenderers() {return this->Renderers;};
    00117
    00120   virtual void Render();
    00121
    00123   virtual void Start() = 0;
    00124
    00127   virtual void Frame() = 0;
    00128
    00131   virtual void CopyResultFrame();
    00132
    00136   virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor();
    00137
    00139
    00142   virtual void HideCursor() = 0;
    00143   virtual void ShowCursor() = 0;
    00144   virtual void SetCursorPosition(int , int ) {};
    00146
    00148
    00149   vtkSetMacro(CurrentCursor,int);
    00150   vtkGetMacro(CurrentCursor,int);
    00152
    00154
    00155   virtual void SetFullScreen(int) = 0;
    00156   vtkGetMacro(FullScreen,int);
    00157   vtkBooleanMacro(FullScreen,int);
    00159
    00161
    00164   vtkSetMacro(Borders,int);
    00165   vtkGetMacro(Borders,int);
    00166   vtkBooleanMacro(Borders,int);
    00168
    00170
    00172   vtkGetMacro(StereoCapableWindow,int);
    00173   vtkBooleanMacro(StereoCapableWindow,int);
    00174   virtual void SetStereoCapableWindow(int capable);
    00176
    00178
    00179   vtkGetMacro(StereoRender,int);
    00180   void SetStereoRender(int stereo);
    00181   vtkBooleanMacro(StereoRender,int);
    00183
    00185
    00187   vtkSetMacro(PointSmoothing,int);
    00188   vtkGetMacro(PointSmoothing,int);
    00189   vtkBooleanMacro(PointSmoothing,int);
    00191
    00193
    00195   vtkSetMacro(LineSmoothing,int);
    00196   vtkGetMacro(LineSmoothing,int);
    00197   vtkBooleanMacro(LineSmoothing,int);
    00199
    00201
    00203   vtkSetMacro(PolygonSmoothing,int);
    00204   vtkGetMacro(PolygonSmoothing,int);
    00205   vtkBooleanMacro(PolygonSmoothing,int);
    00207
    00209
    00210   vtkGetMacro(StereoType,int);
    00211   vtkSetMacro(StereoType,int);
    00212   void SetStereoTypeToCrystalEyes()
    00213     {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);};
    00214   void SetStereoTypeToRedBlue()
    00215     {this->SetStereoType(VTK_STEREO_RED_BLUE);};
    00216   void SetStereoTypeToInterlaced()
    00217     {this->SetStereoType(VTK_STEREO_INTERLACED);};
    00218   void SetStereoTypeToLeft()
    00219     {this->SetStereoType(VTK_STEREO_LEFT);};
    00220   void SetStereoTypeToRight()
    00221     {this->SetStereoType(VTK_STEREO_RIGHT);};
    00222   void SetStereoTypeToDresden()
    00223     {this->SetStereoType(VTK_STEREO_DRESDEN);};
    00224   char *GetStereoTypeAsString();
    00226
    00230   virtual void StereoUpdate();
    00231
    00234   virtual void StereoMidpoint();
    00235
    00238   virtual void StereoRenderComplete();
    00239
    00243   virtual void WindowRemap() = 0;
    00244
    00246
    00247   vtkSetMacro(SwapBuffers,int);
    00248   vtkGetMacro(SwapBuffers,int);
    00249   vtkBooleanMacro(SwapBuffers,int);
    00251
    00253
    00261   virtual int SetPixelData(int, int, int, int, unsigned char *,int) = 0;
    00262   virtual int SetPixelData(int, int, int, int, vtkUnsignedCharArray*,
    00263                            int ) = 0;
    00265
    00267
    00272   virtual float *GetRGBAPixelData(int ,int ,int ,int ,int ) = 0;
    00273   virtual int GetRGBAPixelData(int, int, int, int, int, vtkFloatArray* ) = 0;
    00274   virtual int SetRGBAPixelData(int ,int ,int ,int ,float *,int,
    00275                                int blend=0) = 0;
    00276   virtual int SetRGBAPixelData(int, int, int, int, vtkFloatArray*,
    00277                                int, int blend=0) = 0;
    00278   virtual void ReleaseRGBAPixelData(float *data)=0;
    00279   virtual unsigned char *GetRGBACharPixelData(int ,int ,int ,int ,int ) = 0;
    00280   virtual int GetRGBACharPixelData(int ,int, int, int, int,
    00281                                    vtkUnsignedCharArray*) = 0;
    00282   virtual int SetRGBACharPixelData(int ,int ,int ,int ,unsigned char *, int,
    00283                                    int blend=0) = 0;
    00284   virtual int SetRGBACharPixelData(int, int, int, int,
    00285                                    vtkUnsignedCharArray *,
    00286                                    int, int blend=0) = 0;
    00288
    00290
    00291   virtual float *GetZbufferData(int, int, int, int ) = 0;
    00292   virtual int GetZbufferData( int, int, int, int, vtkFloatArray*) = 0;
    00293   virtual int SetZbufferData(int, int, int, int, float *) = 0;
    00294   virtual int SetZbufferData( int, int, int, int, vtkFloatArray * ) = 0;
    00296
    00298
    00301   vtkGetMacro(AAFrames,int);
    00302   vtkSetMacro(AAFrames,int);
    00304
    00306
    00311   vtkGetMacro(FDFrames,int);
    00312   vtkSetMacro(FDFrames,int);
    00314
    00316
    00321   vtkGetMacro(SubFrames,int);
    00322   vtkSetMacro(SubFrames,int);
    00324
    00326
    00327   vtkGetMacro(NeverRendered,int);
    00329
    00331
    00333   vtkGetMacro(AbortRender,int);
    00334   vtkSetMacro(AbortRender,int);
    00335   vtkGetMacro(InAbortCheck,int);
    00336   vtkSetMacro(InAbortCheck,int);
    00337   virtual int CheckAbortStatus();
    00339
    00340   vtkGetMacro(IsPicking,int);
    00341   vtkSetMacro(IsPicking,int);
    00342   vtkBooleanMacro(IsPicking,int);
    00343
    00348   virtual int GetEventPending() = 0;
    00349
    00351   virtual int  CheckInRenderStatus() { return this->InRender; }
    00352
    00354   virtual void ClearInRenderStatus() { this->InRender = 0; }
    00355
    00357
    00358 #ifndef VTK_REMOVE_LEGACY_CODE
    00359   void SetAbortCheckMethod(void (*f)(void *), void *arg);
    00360   void SetAbortCheckMethodArgDelete(void (*f)(void *));
    00362 #endif
    00363
    00365
    00370   void SetDesiredUpdateRate(float);
    00371   vtkGetMacro(DesiredUpdateRate,float);
    00373
    00375
    00379   vtkGetMacro(NumberOfLayers, int);
    00380   vtkSetClampMacro(NumberOfLayers, int, 1, VTK_LARGE_INTEGER);
    00382
    00384
    00385   vtkGetObjectMacro(Interactor,vtkRenderWindowInteractor);
    00386   void SetInteractor(vtkRenderWindowInteractor *);
    00388
    00391   virtual void UnRegister(vtkObjectBase *o);
    00392
    00394
    00395   virtual void SetDisplayId(void *) = 0;
    00396   virtual void SetWindowId(void *)  = 0;
    00397   virtual void SetParentId(void *)  = 0;
    00398   virtual void *GetGenericDisplayId() = 0;
    00399   virtual void *GetGenericWindowId() = 0;
    00400   virtual void *GetGenericParentId() = 0;
    00401   virtual void *GetGenericContext() = 0;
    00402   virtual void *GetGenericDrawable() = 0;
    00403   virtual void SetWindowInfo(char *) = 0;
    00404   virtual void SetParentInfo(char *) = 0;
    00406
    00408   virtual void MakeCurrent() = 0;
    00409
    00413   virtual void SetForceMakeCurrent() {};
    00414
    00416   virtual const char *ReportCapabilities() { return "Not Implemented";};
    00417
    00419   virtual int SupportsOpenGL() { return 0;};
    00420
    00422   virtual int IsDirect() { return 0;};
    00423
    00426   virtual int GetDepthBufferSize() = 0;
    00427
    00428 protected:
    00429   vtkRenderWindow();
    00430   ~vtkRenderWindow();
    00431
    00432   virtual void DoStereoRender();
    00433   virtual void DoFDRender();
    00434   virtual void DoAARender();
    00435
    00436   vtkRendererCollection *Renderers;
    00437   int Borders;
    00438   int FullScreen;
    00439   int OldScreen[5];
    00440   int PointSmoothing;
    00441   int LineSmoothing;
    00442   int PolygonSmoothing;
    00443   int StereoRender;
    00444   int StereoType;
    00445   int StereoStatus; // used for keeping track of what's going on
    00446   int StereoCapableWindow;
    00447   vtkRenderWindowInteractor *Interactor;
    00448   unsigned char* StereoBuffer; // used for red blue stereo
    00449   float *AccumulationBuffer;   // used for many techniques
    00450   unsigned int AccumulationBufferSize;
    00451   int AAFrames;
    00452   int FDFrames;
    00453   int SubFrames;               // number of sub frames
    00454   int CurrentSubFrame;         // what one are we on
    00455   unsigned char *ResultFrame;  // used for any non immediate rendering
    00456   int   SwapBuffers;
    00457   float DesiredUpdateRate;
    00458   int   AbortRender;
    00459   int   InAbortCheck;
    00460   int   InRender;
    00461   int   NeverRendered;
    00462   int   NumberOfLayers;
    00463   void (*AbortCheckMethod)(void *);
    00464   void (*AbortCheckMethodArgDelete)(void *);
    00465   void *AbortCheckMethodArg;
    00466   int CurrentCursor;
    00467   int IsPicking;
    00468
    00469 private:
    00470   vtkRenderWindow(const vtkRenderWindow&);  // Not implemented.
    00471   void operator=(const vtkRenderWindow&);  // Not implemented.
    00472 };
    00473
    00475 inline char *vtkRenderWindow::GetStereoTypeAsString(void)
    00476 {
    00477   switch ( this->StereoType )
    00478     {
    00479     case VTK_STEREO_CRYSTAL_EYES:
    00480       return (char *)"CrystalEyes";
    00481     case VTK_STEREO_RED_BLUE:
    00482       return (char *)"RedBlue";
    00483     case VTK_STEREO_LEFT:
    00484       return (char *)"Left";
    00485     case VTK_STEREO_RIGHT:
    00486       return (char *)"Right";
    00487     case VTK_STEREO_DRESDEN:
    00488       return (char *)"DresdenDisplay";
    00489     default:
    00490       return (char *)"";
    00491     }
    00492 }
    00493
    00494 #endif
    00495
    00496