Main Page Class Hierarchy Alphabetical List Compound List File List Compound 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   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 =========================================================================*/
    00046 #ifndef __vtkWin32OpenGLRenderWindow_h
    00047 #define __vtkWin32OpenGLRenderWindow_h
    00048
    00049 #include "vtkOpenGLRenderWindow.h"
    00050
    00051 #ifndef VTK_IMPLEMENT_MESA_CXX
    00052 #include <GL/gl.h> // Needed for mesa internals
    00053 #endif
    00054
    00055 class vtkIdList;
    00056
    00057 class VTK_RENDERING_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow
    00058 {
    00059 public:
    00060   static vtkWin32OpenGLRenderWindow *New();
    00061   vtkTypeRevisionMacro(vtkWin32OpenGLRenderWindow,vtkOpenGLRenderWindow);
    00062   void PrintSelf(ostream& os, vtkIndent indent);
    00063
    00065   virtual void Start(void);
    00066
    00068   void Frame(void);
    00069
    00071   virtual void WindowInitialize(void);
    00072
    00074   virtual void Initialize(void);
    00075
    00077   virtual void SetFullScreen(int);
    00078
    00080   virtual void WindowRemap(void);
    00081
    00083   virtual void PrefFullScreen(void);
    00084
    00086
    00087   virtual void SetSize(int,int);
    00088   virtual void SetSize(int a[2]) {vtkOpenGLRenderWindow::SetSize(a);};
    00090
    00092   virtual int *GetSize();
    00093
    00095
    00096   virtual void SetPosition(int,int);
    00097   virtual void SetPosition(int a[2]) {vtkOpenGLRenderWindow::SetPosition(a);};
    00099
    00101   virtual int *GetScreenSize();
    00102
    00104   virtual int *GetPosition();
    00105
    00108   virtual void SetWindowName(const char *);
    00109
    00111   void SetWindowInfo(char *);
    00112
    00114   void SetParentInfo(char *);
    00115
    00116   //BTX
    00117   virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
    00118   virtual void *GetGenericWindowId()  {return (void *)this->WindowId;};
    00119   virtual void *GetGenericParentId()  {return (void *)this->ParentId;};
    00120   virtual void *GetGenericContext()   {return (void *)this->DeviceContext;};
    00121   virtual void *GetGenericDrawable()  {return (void *)this->WindowId;};
    00122   virtual void SetDisplayId(void *);
    00123
    00125
    00126   virtual HWND  GetWindowId();
    00127   void  SetWindowId(void *foo) {this->SetWindowId((HWND)foo);};
    00129
    00131   virtual void  SetWindowId(HWND);
    00132
    00134
    00135   virtual void  SetParentId(HWND);
    00136   void  SetParentId(void *foo) {this->SetParentId((HWND)foo);};
    00138
    00139   void  SetContextId(HGLRC);    // hsr
    00140   void  SetDeviceContext(HDC);  // hsr
    00141
    00143
    00144   virtual void  SetNextWindowId(HWND);
    00145   //ETX
    00147
    00152   virtual void SetStereoCapableWindow(int capable);
    00153
    00155   void MakeCurrent();
    00156
    00158   const char *ReportCapabilities();
    00159
    00161   int SupportsOpenGL();
    00162
    00164   int IsDirect();
    00165
    00169   virtual  int GetEventPending();
    00170
    00172
    00174   void SetupMemoryRendering(int x, int y, HDC prn);
    00175   void SetupMemoryRendering(HBITMAP hbmp);
    00176   void ResumeScreenRendering(void);
    00177   HDC GetMemoryDC();
    00178   unsigned char *GetMemoryData(){return this->MemoryData;};
    00180
    00182
    00183   virtual void SetupPalette(HDC hDC);
    00184   virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug,
    00185                                 int bpp=16, int zbpp=16);
    00187
    00189   void Clean();
    00190
    00192
    00195   void HideCursor();
    00196   void ShowCursor();
    00197   void SetCursorPosition(int x, int y);
    00199
    00201   virtual void SetCurrentCursor(int);
    00202
    00205   virtual void SetOffScreenRendering(int offscreen);
    00206
    00207 protected:
    00208   vtkWin32OpenGLRenderWindow();
    00209   ~vtkWin32OpenGLRenderWindow();
    00210
    00211   HINSTANCE ApplicationInstance;
    00212   HPALETTE  Palette;
    00213   HPALETTE  OldPalette;
    00214   HGLRC     ContextId;
    00215   HDC       DeviceContext;
    00216   BOOL      MFChandledWindow;
    00217   HWND      WindowId;
    00218   HWND      ParentId;
    00219   HWND      NextWindowId;
    00220   int       OwnWindow;
    00221   int       ScreenSize[2];
    00222
    00223   // the following is used to support rendering into memory
    00224   BITMAPINFO MemoryDataHeader;
    00225   HBITMAP MemoryBuffer;
    00226   unsigned char *MemoryData;    // the data in the DIBSection
    00227   HDC MemoryHdc;
    00228
    00229   int ScreenMapped;
    00230   int ScreenWindowSize[2];
    00231   HDC ScreenDeviceContext;
    00232   int ScreenDoubleBuffer;
    00233   HGLRC ScreenContextId;
    00234
    00235   //BTX
    00236   // message handler
    00237   virtual LRESULT MessageProc(HWND hWnd, UINT message,
    00238                               WPARAM wParam, LPARAM lParam);
    00239
    00240   static LRESULT APIENTRY WndProc(HWND hWnd, UINT message,
    00241                                   WPARAM wParam, LPARAM lParam);
    00242   //ETX
    00243   int CursorHidden;
    00244   int ForceMakeCurrent;
    00245
    00246   char   *Capabilities;
    00247
    00248   void ResizeWhileOffscreen(int xsize, int ysize);
    00249   void CreateAWindow(int x, int y, int width, int height);
    00250   void InitializeApplication();
    00251   void CleanUpOffScreenRendering(void);
    00252   void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
    00253   void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
    00254 private:
    00255   vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&);  // Not implemented.
    00256   void operator=(const vtkWin32OpenGLRenderWindow&);  // Not implemented.
    00257 };
    00258
    00259
    00260 #endif
    00261