VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkWin32OpenGLRenderWindow.h 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 =========================================================================*/ 00032 #ifndef __vtkWin32OpenGLRenderWindow_h 00033 #define __vtkWin32OpenGLRenderWindow_h 00034 00035 #include "vtkRenderingOpenGLModule.h" // For export macro 00036 #include "vtkOpenGLRenderWindow.h" 00037 00038 class vtkIdList; 00039 00040 class VTKRENDERINGOPENGL_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow 00041 { 00042 public: 00043 static vtkWin32OpenGLRenderWindow *New(); 00044 vtkTypeMacro(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 virtual HWND GetWindowId(); 00121 00123 00124 virtual void SetWindowId(HWND); 00125 void SetWindowId(void *foo) {this->SetWindowId((HWND)foo);}; 00127 00130 virtual bool InitializeFromCurrentContext(); 00131 00133 00134 virtual void SetParentId(HWND); 00135 void SetParentId(void *foo) {this->SetParentId((HWND)foo);}; 00137 00138 void SetContextId(HGLRC); // hsr 00139 void SetDeviceContext(HDC); // hsr 00140 00142 virtual void SetNextWindowId(HWND); 00143 00146 virtual void SetNextWindowId(void *arg); 00147 00148 //ETX 00149 00154 virtual void SetStereoCapableWindow(int capable); 00155 00157 void MakeCurrent(); 00158 00161 virtual bool IsCurrent(); 00162 00164 const char *ReportCapabilities(); 00165 00167 int SupportsOpenGL(); 00168 00170 int IsDirect(); 00171 00175 virtual int GetEventPending(); 00176 00178 00180 void SetupMemoryRendering(int x, int y, HDC prn); 00181 void SetupMemoryRendering(HBITMAP hbmp); 00182 void ResumeScreenRendering(void); 00183 HDC GetMemoryDC(); 00184 unsigned char *GetMemoryData(){return this->MemoryData;}; 00186 00188 00189 virtual void SetupPalette(HDC hDC); 00190 virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug, 00191 int bpp=16, int zbpp=16); 00193 00195 void Clean(); 00196 00198 00201 void HideCursor(); 00202 void ShowCursor(); 00203 void SetCursorPosition(int x, int y); 00205 00207 virtual void SetCurrentCursor(int); 00208 00211 virtual void SetOffScreenRendering(int offscreen); 00212 00213 protected: 00214 vtkWin32OpenGLRenderWindow(); 00215 ~vtkWin32OpenGLRenderWindow(); 00216 00217 HINSTANCE ApplicationInstance; 00218 HPALETTE Palette; 00219 HPALETTE OldPalette; 00220 HGLRC ContextId; 00221 HDC DeviceContext; 00222 BOOL MFChandledWindow; 00223 HWND WindowId; 00224 HWND ParentId; 00225 HWND NextWindowId; 00226 int OwnWindow; 00227 int ScreenSize[2]; 00228 00229 // the following is used to support rendering into memory 00230 BITMAPINFO MemoryDataHeader; 00231 HBITMAP MemoryBuffer; 00232 unsigned char *MemoryData; // the data in the DIBSection 00233 HDC MemoryHdc; 00234 00235 int ScreenMapped; 00236 int ScreenWindowSize[2]; 00237 HDC ScreenDeviceContext; 00238 int ScreenDoubleBuffer; 00239 HGLRC ScreenContextId; 00240 00241 int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...) 00242 00243 //BTX 00244 // message handler 00245 virtual LRESULT MessageProc(HWND hWnd, UINT message, 00246 WPARAM wParam, LPARAM lParam); 00247 00248 static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, 00249 WPARAM wParam, LPARAM lParam); 00250 //ETX 00251 int CursorHidden; 00252 int ForceMakeCurrent; 00253 00254 char *Capabilities; 00255 int WindowIdReferenceCount; 00256 void ResizeWhileOffscreen(int xsize, int ysize); 00257 virtual void CreateAWindow(); 00258 virtual void DestroyWindow(); 00259 void InitializeApplication(); 00260 void CleanUpOffScreenRendering(void); 00261 void CreateOffScreenDC(int xsize, int ysize, HDC aHdc); 00262 void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc); 00263 void CreateOffScreenWindow(int width,int height); 00264 void SaveScreenRendering(); 00265 void CleanUpRenderers(); 00266 00267 private: 00268 vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented. 00269 void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented. 00270 }; 00271 00272 00273 #endif 00274