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 "vtkOpenGLRenderWindow.h" 00036 00037 class vtkIdList; 00038 00039 class VTK_RENDERING_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow 00040 { 00041 public: 00042 static vtkWin32OpenGLRenderWindow *New(); 00043 vtkTypeMacro(vtkWin32OpenGLRenderWindow,vtkOpenGLRenderWindow); 00044 void PrintSelf(ostream& os, vtkIndent indent); 00045 00047 virtual void Start(void); 00048 00050 void Frame(void); 00051 00053 virtual void WindowInitialize(void); 00054 00059 virtual void Initialize(void); 00060 00065 virtual void Finalize(void); 00066 00068 virtual void SetFullScreen(int); 00069 00071 virtual void WindowRemap(void); 00072 00074 virtual void PrefFullScreen(void); 00075 00077 00078 virtual void SetSize(int,int); 00079 virtual void SetSize(int a[2]) {vtkOpenGLRenderWindow::SetSize(a);}; 00081 00083 virtual int *GetSize(); 00084 00086 00087 virtual void SetPosition(int,int); 00088 virtual void SetPosition(int a[2]) {vtkOpenGLRenderWindow::SetPosition(a);}; 00090 00092 virtual int *GetScreenSize(); 00093 00095 virtual int *GetPosition(); 00096 00099 virtual void SetWindowName(const char *); 00100 00102 void SetWindowInfo(char *); 00103 00105 void SetNextWindowInfo(char *); 00106 00108 void SetParentInfo(char *); 00109 00110 //BTX 00111 virtual void *GetGenericDisplayId() {return (void *)this->ContextId;}; 00112 virtual void *GetGenericWindowId() {return (void *)this->WindowId;}; 00113 virtual void *GetGenericParentId() {return (void *)this->ParentId;}; 00114 virtual void *GetGenericContext() {return (void *)this->DeviceContext;}; 00115 virtual void *GetGenericDrawable() {return (void *)this->WindowId;}; 00116 virtual void SetDisplayId(void *); 00117 00119 00120 virtual HWND GetWindowId(); 00121 void SetWindowId(void *foo) {this->SetWindowId((HWND)foo);}; 00123 00125 virtual void SetWindowId(HWND); 00126 00128 00129 virtual void SetParentId(HWND); 00130 void SetParentId(void *foo) {this->SetParentId((HWND)foo);}; 00132 00133 void SetContextId(HGLRC); // hsr 00134 void SetDeviceContext(HDC); // hsr 00135 00137 virtual void SetNextWindowId(HWND); 00138 00141 virtual void SetNextWindowId(void *arg); 00142 00143 //ETX 00144 00149 virtual void SetStereoCapableWindow(int capable); 00150 00152 void MakeCurrent(); 00153 00156 virtual bool IsCurrent(); 00157 00159 const char *ReportCapabilities(); 00160 00162 int SupportsOpenGL(); 00163 00165 int IsDirect(); 00166 00170 virtual int GetEventPending(); 00171 00173 00175 void SetupMemoryRendering(int x, int y, HDC prn); 00176 void SetupMemoryRendering(HBITMAP hbmp); 00177 void ResumeScreenRendering(void); 00178 HDC GetMemoryDC(); 00179 unsigned char *GetMemoryData(){return this->MemoryData;}; 00181 00183 00184 virtual void SetupPalette(HDC hDC); 00185 virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug, 00186 int bpp=16, int zbpp=16); 00188 00190 void Clean(); 00191 00193 00196 void HideCursor(); 00197 void ShowCursor(); 00198 void SetCursorPosition(int x, int y); 00200 00202 virtual void SetCurrentCursor(int); 00203 00206 virtual void SetOffScreenRendering(int offscreen); 00207 00208 protected: 00209 vtkWin32OpenGLRenderWindow(); 00210 ~vtkWin32OpenGLRenderWindow(); 00211 00212 HINSTANCE ApplicationInstance; 00213 HPALETTE Palette; 00214 HPALETTE OldPalette; 00215 HGLRC ContextId; 00216 HDC DeviceContext; 00217 BOOL MFChandledWindow; 00218 HWND WindowId; 00219 HWND ParentId; 00220 HWND NextWindowId; 00221 int OwnWindow; 00222 int ScreenSize[2]; 00223 00224 // the following is used to support rendering into memory 00225 BITMAPINFO MemoryDataHeader; 00226 HBITMAP MemoryBuffer; 00227 unsigned char *MemoryData; // the data in the DIBSection 00228 HDC MemoryHdc; 00229 00230 int ScreenMapped; 00231 int ScreenWindowSize[2]; 00232 HDC ScreenDeviceContext; 00233 int ScreenDoubleBuffer; 00234 HGLRC ScreenContextId; 00235 00236 int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...) 00237 00238 //BTX 00239 // message handler 00240 virtual LRESULT MessageProc(HWND hWnd, UINT message, 00241 WPARAM wParam, LPARAM lParam); 00242 00243 static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, 00244 WPARAM wParam, LPARAM lParam); 00245 //ETX 00246 int CursorHidden; 00247 int ForceMakeCurrent; 00248 00249 char *Capabilities; 00250 int WindowIdReferenceCount; 00251 void ResizeWhileOffscreen(int xsize, int ysize); 00252 virtual void CreateAWindow(); 00253 virtual void DestroyWindow(); 00254 void InitializeApplication(); 00255 void CleanUpOffScreenRendering(void); 00256 void CreateOffScreenDC(int xsize, int ysize, HDC aHdc); 00257 void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc); 00258 void CreateOffScreenWindow(int width,int height); 00259 void SaveScreenRendering(); 00260 void CleanUpRenderers(); 00261 00262 private: 00263 vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented. 00264 void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented. 00265 }; 00266 00267 00268 #endif 00269