VTK
|
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 =========================================================================*/ 00026 #ifndef __vtkWin32OpenGLRenderWindow_h 00027 #define __vtkWin32OpenGLRenderWindow_h 00028 00029 #include "vtkOpenGLRenderWindow.h" 00030 00031 class vtkIdList; 00032 00033 class VTK_RENDERING_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow 00034 { 00035 public: 00036 static vtkWin32OpenGLRenderWindow *New(); 00037 vtkTypeRevisionMacro(vtkWin32OpenGLRenderWindow,vtkOpenGLRenderWindow); 00038 void PrintSelf(ostream& os, vtkIndent indent); 00039 00041 virtual void Start(void); 00042 00044 void Frame(void); 00045 00047 virtual void WindowInitialize(void); 00048 00053 virtual void Initialize(void); 00054 00059 virtual void Finalize(void); 00060 00062 virtual void SetFullScreen(int); 00063 00065 virtual void WindowRemap(void); 00066 00068 virtual void PrefFullScreen(void); 00069 00071 00072 virtual void SetSize(int,int); 00073 virtual void SetSize(int a[2]) {vtkOpenGLRenderWindow::SetSize(a);}; 00075 00077 virtual int *GetSize(); 00078 00080 00081 virtual void SetPosition(int,int); 00082 virtual void SetPosition(int a[2]) {vtkOpenGLRenderWindow::SetPosition(a);}; 00084 00086 virtual int *GetScreenSize(); 00087 00089 virtual int *GetPosition(); 00090 00093 virtual void SetWindowName(const char *); 00094 00096 void SetWindowInfo(char *); 00097 00099 void SetNextWindowInfo(char *); 00100 00102 void SetParentInfo(char *); 00103 00104 //BTX 00105 virtual void *GetGenericDisplayId() {return (void *)this->ContextId;}; 00106 virtual void *GetGenericWindowId() {return (void *)this->WindowId;}; 00107 virtual void *GetGenericParentId() {return (void *)this->ParentId;}; 00108 virtual void *GetGenericContext() {return (void *)this->DeviceContext;}; 00109 virtual void *GetGenericDrawable() {return (void *)this->WindowId;}; 00110 virtual void SetDisplayId(void *); 00111 00113 00114 virtual HWND GetWindowId(); 00115 void SetWindowId(void *foo) {this->SetWindowId((HWND)foo);}; 00117 00119 virtual void SetWindowId(HWND); 00120 00122 00123 virtual void SetParentId(HWND); 00124 void SetParentId(void *foo) {this->SetParentId((HWND)foo);}; 00126 00127 void SetContextId(HGLRC); // hsr 00128 void SetDeviceContext(HDC); // hsr 00129 00131 virtual void SetNextWindowId(HWND); 00132 00135 virtual void SetNextWindowId(void *arg); 00136 00137 //ETX 00138 00143 virtual void SetStereoCapableWindow(int capable); 00144 00146 void MakeCurrent(); 00147 00150 virtual bool IsCurrent(); 00151 00153 const char *ReportCapabilities(); 00154 00156 int SupportsOpenGL(); 00157 00159 int IsDirect(); 00160 00164 virtual int GetEventPending(); 00165 00167 00169 void SetupMemoryRendering(int x, int y, HDC prn); 00170 void SetupMemoryRendering(HBITMAP hbmp); 00171 void ResumeScreenRendering(void); 00172 HDC GetMemoryDC(); 00173 unsigned char *GetMemoryData(){return this->MemoryData;}; 00175 00177 00178 virtual void SetupPalette(HDC hDC); 00179 virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug, 00180 int bpp=16, int zbpp=16); 00182 00184 void Clean(); 00185 00187 00190 void HideCursor(); 00191 void ShowCursor(); 00192 void SetCursorPosition(int x, int y); 00194 00196 virtual void SetCurrentCursor(int); 00197 00200 virtual void SetOffScreenRendering(int offscreen); 00201 00202 protected: 00203 vtkWin32OpenGLRenderWindow(); 00204 ~vtkWin32OpenGLRenderWindow(); 00205 00206 HINSTANCE ApplicationInstance; 00207 HPALETTE Palette; 00208 HPALETTE OldPalette; 00209 HGLRC ContextId; 00210 HDC DeviceContext; 00211 BOOL MFChandledWindow; 00212 HWND WindowId; 00213 HWND ParentId; 00214 HWND NextWindowId; 00215 int OwnWindow; 00216 int ScreenSize[2]; 00217 00218 // the following is used to support rendering into memory 00219 BITMAPINFO MemoryDataHeader; 00220 HBITMAP MemoryBuffer; 00221 unsigned char *MemoryData; // the data in the DIBSection 00222 HDC MemoryHdc; 00223 00224 int ScreenMapped; 00225 int ScreenWindowSize[2]; 00226 HDC ScreenDeviceContext; 00227 int ScreenDoubleBuffer; 00228 HGLRC ScreenContextId; 00229 00230 int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...) 00231 00232 //BTX 00233 // message handler 00234 virtual LRESULT MessageProc(HWND hWnd, UINT message, 00235 WPARAM wParam, LPARAM lParam); 00236 00237 static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, 00238 WPARAM wParam, LPARAM lParam); 00239 //ETX 00240 int CursorHidden; 00241 int ForceMakeCurrent; 00242 00243 char *Capabilities; 00244 int WindowIdReferenceCount; 00245 void ResizeWhileOffscreen(int xsize, int ysize); 00246 virtual void CreateAWindow(); 00247 virtual void DestroyWindow(); 00248 void InitializeApplication(); 00249 void CleanUpOffScreenRendering(void); 00250 void CreateOffScreenDC(int xsize, int ysize, HDC aHdc); 00251 void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc); 00252 void CreateOffScreenWindow(int width,int height); 00253 void SaveScreenRendering(); 00254 void CleanUpRenderers(); 00255 00256 private: 00257 vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented. 00258 void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented. 00259 }; 00260 00261 00262 #endif 00263