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

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 =========================================================================*/
00042 #ifndef __vtkWin32OpenGLRenderWindow_h
00043 #define __vtkWin32OpenGLRenderWindow_h
00044 
00045 #include "vtkOpenGLRenderWindow.h"
00046 
00047 #ifndef VTK_IMPLEMENT_MESA_CXX
00048 #include <GL/gl.h> // Needed for mesa internals
00049 #endif
00050 
00051 class vtkIdList;
00052 
00053 class VTK_RENDERING_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow
00054 {
00055 public:
00056   static vtkWin32OpenGLRenderWindow *New();
00057   vtkTypeRevisionMacro(vtkWin32OpenGLRenderWindow,vtkOpenGLRenderWindow);
00058   void PrintSelf(ostream& os, vtkIndent indent);
00059 
00061   virtual void Start(void);
00062 
00064   void Frame(void);
00065 
00067   virtual void WindowInitialize(void);
00068 
00073   virtual void Initialize(void);
00074 
00079   virtual void Finalize(void);
00080 
00082   virtual void SetFullScreen(int);
00083 
00085   virtual void WindowRemap(void);
00086 
00088   virtual void PrefFullScreen(void);
00089 
00091 
00092   virtual void SetSize(int,int);
00093   virtual void SetSize(int a[2]) {vtkOpenGLRenderWindow::SetSize(a);};
00095   
00097   virtual int *GetSize();
00098 
00100 
00101   virtual void SetPosition(int,int);
00102   virtual void SetPosition(int a[2]) {vtkOpenGLRenderWindow::SetPosition(a);};
00104   
00106   virtual int *GetScreenSize();
00107 
00109   virtual int *GetPosition();
00110 
00113   virtual void SetWindowName(const char *);
00114   
00116   void SetWindowInfo(char *);
00117 
00119   void SetNextWindowInfo(char *);
00120 
00122   void SetParentInfo(char *);
00123 
00124   //BTX
00125   virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
00126   virtual void *GetGenericWindowId()  {return (void *)this->WindowId;};
00127   virtual void *GetGenericParentId()  {return (void *)this->ParentId;};
00128   virtual void *GetGenericContext()   {return (void *)this->DeviceContext;};
00129   virtual void *GetGenericDrawable()  {return (void *)this->WindowId;};
00130   virtual void SetDisplayId(void *);
00131 
00133 
00134   virtual HWND  GetWindowId();
00135   void  SetWindowId(void *foo) {this->SetWindowId((HWND)foo);};
00137 
00139   virtual void  SetWindowId(HWND);
00140   
00142 
00143   virtual void  SetParentId(HWND);
00144   void  SetParentId(void *foo) {this->SetParentId((HWND)foo);};
00146 
00147   void  SetContextId(HGLRC);    // hsr
00148   void  SetDeviceContext(HDC);  // hsr
00149 
00151   virtual void  SetNextWindowId(HWND);
00152 
00155   virtual void SetNextWindowId(void *arg);
00156 
00157   //ETX
00158 
00163   virtual void SetStereoCapableWindow(int capable);
00164 
00166   void MakeCurrent();
00167 
00169   const char *ReportCapabilities();
00170 
00172   int SupportsOpenGL();
00173 
00175   int IsDirect();
00176 
00180   virtual  int GetEventPending();
00181 
00183 
00185   void SetupMemoryRendering(int x, int y, HDC prn);
00186   void SetupMemoryRendering(HBITMAP hbmp);
00187   void ResumeScreenRendering(void);
00188   HDC GetMemoryDC();
00189   unsigned char *GetMemoryData(){return this->MemoryData;};  
00191 
00193 
00194   virtual void SetupPalette(HDC hDC);
00195   virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug, 
00196                                 int bpp=16, int zbpp=16);
00198   
00200   void Clean();
00201 
00203 
00206   void HideCursor();
00207   void ShowCursor();
00208   void SetCursorPosition(int x, int y);
00210 
00212   virtual void SetCurrentCursor(int);
00213 
00216   virtual void SetOffScreenRendering(int offscreen);
00217 
00218 protected:
00219   vtkWin32OpenGLRenderWindow();
00220   ~vtkWin32OpenGLRenderWindow();
00221 
00222   HINSTANCE ApplicationInstance;
00223   HPALETTE  Palette;
00224   HPALETTE  OldPalette;
00225   HGLRC     ContextId;
00226   HDC       DeviceContext;
00227   BOOL      MFChandledWindow;
00228   HWND      WindowId;
00229   HWND      ParentId;
00230   HWND      NextWindowId;
00231   int       OwnWindow;
00232   int       ScreenSize[2];
00233 
00234   // the following is used to support rendering into memory
00235   BITMAPINFO MemoryDataHeader;
00236   HBITMAP MemoryBuffer;
00237   unsigned char *MemoryData;    // the data in the DIBSection
00238   HDC MemoryHdc;
00239 
00240   int ScreenMapped;
00241   int ScreenWindowSize[2];
00242   HDC ScreenDeviceContext;
00243   int ScreenDoubleBuffer;
00244   HGLRC ScreenContextId;
00245 
00246   //BTX
00247   // message handler
00248   virtual LRESULT MessageProc(HWND hWnd, UINT message, 
00249                               WPARAM wParam, LPARAM lParam);
00250 
00251   static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, 
00252                                   WPARAM wParam, LPARAM lParam);
00253   //ETX
00254   int CursorHidden;
00255   int ForceMakeCurrent;
00256 
00257   char   *Capabilities;
00258 
00259   void ResizeWhileOffscreen(int xsize, int ysize);
00260   void CreateAWindow(int x, int y, int width, int height);
00261   void InitializeApplication();
00262   void CleanUpOffScreenRendering(void);
00263   void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
00264   void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
00265 private:
00266   vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&);  // Not implemented.
00267   void operator=(const vtkWin32OpenGLRenderWindow&);  // Not implemented.
00268 };
00269 
00270 
00271 #endif
00272