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

dox/Rendering/vtkWin32OpenGLRenderWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkWin32OpenGLRenderWindow.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 =========================================================================*/
00033 #ifndef __vtkWin32OpenGLRenderWindow_h
00034 #define __vtkWin32OpenGLRenderWindow_h
00035 
00036 #include "vtkOpenGLRenderWindow.h"
00037 
00038 #ifndef VTK_IMPLEMENT_MESA_CXX
00039 #include <GL/gl.h> // Needed for mesa internals
00040 #endif
00041 
00042 class vtkIdList;
00043 
00044 class VTK_RENDERING_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow
00045 {
00046 public:
00047   static vtkWin32OpenGLRenderWindow *New();
00048   vtkTypeRevisionMacro(vtkWin32OpenGLRenderWindow,vtkOpenGLRenderWindow);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00052   virtual void Start(void);
00053 
00055   void Frame(void);
00056 
00058   virtual void WindowInitialize(void);
00059 
00061   virtual void Initialize(void);
00062 
00064   virtual void SetFullScreen(int);
00065 
00067   virtual void WindowRemap(void);
00068 
00070   virtual void PrefFullScreen(void);
00071 
00073 
00074   virtual void SetSize(int,int);
00075   virtual void SetSize(int a[2]) {vtkOpenGLRenderWindow::SetSize(a);};
00077   
00079   virtual int *GetSize();
00080 
00082 
00083   virtual void SetPosition(int,int);
00084   virtual void SetPosition(int a[2]) {vtkOpenGLRenderWindow::SetPosition(a);};
00086   
00088   virtual int *GetScreenSize();
00089 
00091   virtual int *GetPosition();
00092 
00095   virtual void SetWindowName(const char *);
00096   
00098   void SetWindowInfo(char *);
00099 
00101   void SetParentInfo(char *);
00102 
00103   //BTX
00104   virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
00105   virtual void *GetGenericWindowId()  {return (void *)this->WindowId;};
00106   virtual void *GetGenericParentId()  {return (void *)this->ParentId;};
00107   virtual void *GetGenericContext()   {return (void *)this->DeviceContext;};
00108   virtual void *GetGenericDrawable()  {return (void *)this->WindowId;};
00109   virtual void SetDisplayId(void *);
00110 
00112 
00113   virtual HWND  GetWindowId();
00114   void  SetWindowId(void *foo) {this->SetWindowId((HWND)foo);};
00116 
00118   virtual void  SetWindowId(HWND);
00119   
00121 
00122   virtual void  SetParentId(HWND);
00123   void  SetParentId(void *foo) {this->SetParentId((HWND)foo);};
00125 
00126   void  SetContextId(HGLRC);    // hsr
00127   void  SetDeviceContext(HDC);  // hsr
00128 
00130 
00131   virtual void  SetNextWindowId(HWND);
00132   //ETX
00134 
00139   virtual void SetStereoCapableWindow(int capable);
00140 
00142   void MakeCurrent();
00143 
00145   const char *ReportCapabilities();
00146 
00148   int SupportsOpenGL();
00149 
00151   int IsDirect();
00152 
00156   virtual  int GetEventPending();
00157 
00159 
00161   void SetupMemoryRendering(int x, int y, HDC prn);
00162   void SetupMemoryRendering(HBITMAP hbmp);
00163   void ResumeScreenRendering(void);
00164   HDC GetMemoryDC();
00165   unsigned char *GetMemoryData(){return this->MemoryData;};  
00167 
00169 
00170   virtual void SetupPalette(HDC hDC);
00171   virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug, 
00172                                 int bpp=16, int zbpp=16);
00174   
00176   void Clean();
00177 
00179 
00182   void HideCursor();
00183   void ShowCursor();
00184   void SetCursorPosition(int x, int y);
00186 
00188   virtual void SetCurrentCursor(int);
00189 
00192   virtual void SetOffScreenRendering(int offscreen);
00193 
00194 protected:
00195   vtkWin32OpenGLRenderWindow();
00196   ~vtkWin32OpenGLRenderWindow();
00197 
00198   HINSTANCE ApplicationInstance;
00199   HPALETTE  Palette;
00200   HPALETTE  OldPalette;
00201   HGLRC     ContextId;
00202   HDC       DeviceContext;
00203   BOOL      MFChandledWindow;
00204   HWND      WindowId;
00205   HWND      ParentId;
00206   HWND      NextWindowId;
00207   int       OwnWindow;
00208   int       ScreenSize[2];
00209 
00210   // the following is used to support rendering into memory
00211   BITMAPINFO MemoryDataHeader;
00212   HBITMAP MemoryBuffer;
00213   unsigned char *MemoryData;    // the data in the DIBSection
00214   HDC MemoryHdc;
00215 
00216   int ScreenMapped;
00217   int ScreenWindowSize[2];
00218   HDC ScreenDeviceContext;
00219   int ScreenDoubleBuffer;
00220   HGLRC ScreenContextId;
00221 
00222   //BTX
00223   // message handler
00224   virtual LRESULT MessageProc(HWND hWnd, UINT message, 
00225                               WPARAM wParam, LPARAM lParam);
00226 
00227   static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, 
00228                                   WPARAM wParam, LPARAM lParam);
00229   //ETX
00230   int CursorHidden;
00231   int ForceMakeCurrent;
00232 
00233   char   *Capabilities;
00234 
00235   void ResizeWhileOffscreen(int xsize, int ysize);
00236   void CreateAWindow(int x, int y, int width, int height);
00237   void InitializeApplication();
00238   void CleanUpOffScreenRendering(void);
00239   void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
00240   void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
00241 private:
00242   vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&);  // Not implemented.
00243   void operator=(const vtkWin32OpenGLRenderWindow&);  // Not implemented.
00244 };
00245 
00246 
00247 #endif
00248