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

Rendering/vtkWin32OpenGLRenderWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkWin32OpenGLRenderWindow.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 =========================================================================*/
00029 #ifndef __vtkWin32OpenGLRenderWindow_h
00030 #define __vtkWin32OpenGLRenderWindow_h
00031 
00032 #include "vtkOpenGLRenderWindow.h"
00033 
00034 #ifndef VTK_IMPLEMENT_MESA_CXX
00035 #include <GL/gl.h> // Needed for mesa internals
00036 #endif
00037 
00038 class vtkIdList;
00039 
00040 class VTK_RENDERING_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow
00041 {
00042 public:
00043   static vtkWin32OpenGLRenderWindow *New();
00044   vtkTypeRevisionMacro(vtkWin32OpenGLRenderWindow,vtkOpenGLRenderWindow);
00045   void PrintSelf(ostream& os, vtkIndent indent);
00046 
00048   virtual void Start(void);
00049 
00051   void Frame(void);
00052 
00054   virtual void WindowInitialize(void);
00055 
00060   virtual void Initialize(void);
00061 
00066   virtual void Finalize(void);
00067 
00069   virtual void SetFullScreen(int);
00070 
00072   virtual void WindowRemap(void);
00073 
00075   virtual void PrefFullScreen(void);
00076 
00078 
00079   virtual void SetSize(int,int);
00080   virtual void SetSize(int a[2]) {vtkOpenGLRenderWindow::SetSize(a);};
00082   
00084   virtual int *GetSize();
00085 
00087 
00088   virtual void SetPosition(int,int);
00089   virtual void SetPosition(int a[2]) {vtkOpenGLRenderWindow::SetPosition(a);};
00091   
00093   virtual int *GetScreenSize();
00094 
00096   virtual int *GetPosition();
00097 
00100   virtual void SetWindowName(const char *);
00101   
00103   void SetWindowInfo(char *);
00104 
00106   void SetNextWindowInfo(char *);
00107 
00109   void SetParentInfo(char *);
00110 
00111   //BTX
00112   virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
00113   virtual void *GetGenericWindowId()  {return (void *)this->WindowId;};
00114   virtual void *GetGenericParentId()  {return (void *)this->ParentId;};
00115   virtual void *GetGenericContext()   {return (void *)this->DeviceContext;};
00116   virtual void *GetGenericDrawable()  {return (void *)this->WindowId;};
00117   virtual void SetDisplayId(void *);
00118 
00120 
00121   virtual HWND  GetWindowId();
00122   void  SetWindowId(void *foo) {this->SetWindowId((HWND)foo);};
00124 
00126   virtual void  SetWindowId(HWND);
00127   
00129 
00130   virtual void  SetParentId(HWND);
00131   void  SetParentId(void *foo) {this->SetParentId((HWND)foo);};
00133 
00134   void  SetContextId(HGLRC);    // hsr
00135   void  SetDeviceContext(HDC);  // hsr
00136 
00138   virtual void  SetNextWindowId(HWND);
00139 
00142   virtual void SetNextWindowId(void *arg);
00143 
00144   //ETX
00145 
00150   virtual void SetStereoCapableWindow(int capable);
00151 
00153   void MakeCurrent();
00154 
00156   const char *ReportCapabilities();
00157 
00159   int SupportsOpenGL();
00160 
00162   int IsDirect();
00163 
00167   virtual  int GetEventPending();
00168 
00170 
00172   void SetupMemoryRendering(int x, int y, HDC prn);
00173   void SetupMemoryRendering(HBITMAP hbmp);
00174   void ResumeScreenRendering(void);
00175   HDC GetMemoryDC();
00176   unsigned char *GetMemoryData(){return this->MemoryData;};  
00178 
00180 
00181   virtual void SetupPalette(HDC hDC);
00182   virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug, 
00183                                 int bpp=16, int zbpp=16);
00185   
00187   void Clean();
00188 
00190 
00193   void HideCursor();
00194   void ShowCursor();
00195   void SetCursorPosition(int x, int y);
00197 
00199   virtual void SetCurrentCursor(int);
00200 
00203   virtual void SetOffScreenRendering(int offscreen);
00204 
00205 protected:
00206   vtkWin32OpenGLRenderWindow();
00207   ~vtkWin32OpenGLRenderWindow();
00208 
00209   HINSTANCE ApplicationInstance;
00210   HPALETTE  Palette;
00211   HPALETTE  OldPalette;
00212   HGLRC     ContextId;
00213   HDC       DeviceContext;
00214   BOOL      MFChandledWindow;
00215   HWND      WindowId;
00216   HWND      ParentId;
00217   HWND      NextWindowId;
00218   int       OwnWindow;
00219   int       ScreenSize[2];
00220 
00221   // the following is used to support rendering into memory
00222   BITMAPINFO MemoryDataHeader;
00223   HBITMAP MemoryBuffer;
00224   unsigned char *MemoryData;    // the data in the DIBSection
00225   HDC MemoryHdc;
00226 
00227   int ScreenMapped;
00228   int ScreenWindowSize[2];
00229   HDC ScreenDeviceContext;
00230   int ScreenDoubleBuffer;
00231   HGLRC ScreenContextId;
00232 
00233   //BTX
00234   // message handler
00235   virtual LRESULT MessageProc(HWND hWnd, UINT message, 
00236                               WPARAM wParam, LPARAM lParam);
00237 
00238   static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, 
00239                                   WPARAM wParam, LPARAM lParam);
00240   //ETX
00241   int CursorHidden;
00242   int ForceMakeCurrent;
00243 
00244   char   *Capabilities;
00245 
00246   void ResizeWhileOffscreen(int xsize, int ysize);
00247   void CreateAWindow(int x, int y, int width, int height);
00248   void InitializeApplication();
00249   void CleanUpOffScreenRendering(void);
00250   void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
00251   void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
00252 private:
00253   vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&);  // Not implemented.
00254   void operator=(const vtkWin32OpenGLRenderWindow&);  // Not implemented.
00255 };
00256 
00257 
00258 #endif
00259