VTK
vtkWin32OpenGLRenderWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkWin32OpenGL2RenderWindow.h
5 
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
26 #ifndef vtkWin32OpenGLRenderWindow_h
27 #define vtkWin32OpenGLRenderWindow_h
28 
29 #include "vtkRenderingOpenGL2Module.h" // For export macro
30 #include "vtkOpenGLRenderWindow.h"
31 
32 #include "vtkWindows.h" // For windows API
33 
34 class vtkIdList;
35 
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
44  virtual void Start(void);
45 
47  void Frame(void);
48 
50  virtual void WindowInitialize(void);
51 
56  virtual void Initialize(void);
57 
62  virtual void Finalize(void);
63 
65  virtual void SetFullScreen(int);
66 
68  virtual void WindowRemap(void);
69 
71  virtual void PrefFullScreen(void);
72 
74 
75  virtual void SetSize(int,int);
76  virtual void SetSize(int a[2]) {vtkOpenGLRenderWindow::SetSize(a);};
78 
80  virtual int *GetSize();
81 
83 
84  virtual void SetPosition(int,int);
85  virtual void SetPosition(int a[2]) {vtkOpenGLRenderWindow::SetPosition(a);};
87 
89  virtual int *GetScreenSize();
90 
92  virtual int *GetPosition();
93 
96  virtual void SetWindowName(const char *);
97 
99  void SetWindowInfo(char *);
100 
102  void SetNextWindowInfo(char *);
103 
105  void SetParentInfo(char *);
106 
107  virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
108  virtual void *GetGenericWindowId() {return (void *)this->WindowId;};
109  virtual void *GetGenericParentId() {return (void *)this->ParentId;};
110  virtual void *GetGenericContext() {return (void *)this->DeviceContext;};
111  virtual void *GetGenericDrawable() {return (void *)this->WindowId;};
112  virtual void SetDisplayId(void *);
113 
115  virtual HWND GetWindowId();
116 
118 
119  virtual void SetWindowId(HWND);
120  void SetWindowId(void *foo) {this->SetWindowId((HWND)foo);};
122 
125  virtual bool InitializeFromCurrentContext();
126 
128 
129  virtual void SetParentId(HWND);
130  void SetParentId(void *foo) {this->SetParentId((HWND)foo);};
132 
133  void SetContextId(HGLRC); // hsr
134  void SetDeviceContext(HDC); // hsr
135 
137  virtual void SetNextWindowId(HWND);
138 
141  virtual void SetNextWindowId(void *arg);
142 
147  virtual void SetStereoCapableWindow(int capable);
148 
150  void MakeCurrent();
151 
154  virtual bool IsCurrent();
155 
157  const char *ReportCapabilities();
158 
160  int SupportsOpenGL();
161 
163  int IsDirect();
164 
168  virtual int GetEventPending();
169 
171 
173  void SetupMemoryRendering(int x, int y, HDC prn);
174  void SetupMemoryRendering(HBITMAP hbmp);
175  void ResumeScreenRendering(void);
176  HDC GetMemoryDC();
177  unsigned char *GetMemoryData(){return this->MemoryData;};
179 
181 
182  virtual void SetupPalette(HDC hDC);
183  virtual void SetupPixelFormatPaletteAndContext(
184  HDC hDC, DWORD dwFlags, int debug,
185  int bpp=16, int zbpp=16);
187 
189  void Clean();
190 
192 
195  void HideCursor();
196  void ShowCursor();
197  void SetCursorPosition(int x, int y);
199 
201  virtual void SetCurrentCursor(int);
202 
203  virtual bool DetectDPI();
204 
207  virtual void SetOffScreenRendering(int offscreen);
208 
209 protected:
212 
213  HINSTANCE ApplicationInstance;
214  HPALETTE Palette;
215  HPALETTE OldPalette;
216  HGLRC ContextId;
217  HDC DeviceContext;
218  BOOL MFChandledWindow;
219  HWND WindowId;
220  HWND ParentId;
221  HWND NextWindowId;
222  int OwnWindow;
223  int ScreenSize[2];
224 
225  // the following is used to support rendering into memory
226  BITMAPINFO MemoryDataHeader;
227  HBITMAP MemoryBuffer;
228  unsigned char *MemoryData; // the data in the DIBSection
229  HDC MemoryHdc;
230 
231  int ScreenMapped;
232  int ScreenWindowSize[2];
233  HDC ScreenDeviceContext;
234  int ScreenDoubleBuffer;
235  HGLRC ScreenContextId;
236 
237  int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...)
238 
239  // message handler
240  virtual LRESULT MessageProc(HWND hWnd, UINT message,
241  WPARAM wParam, LPARAM lParam);
242 
243  static LRESULT APIENTRY WndProc(HWND hWnd, UINT message,
244  WPARAM wParam, LPARAM lParam);
245  int CursorHidden;
246  int ForceMakeCurrent;
247 
248  char *Capabilities;
249  int WindowIdReferenceCount;
250  void ResizeWhileOffscreen(int xsize, int ysize);
251  virtual void CreateAWindow();
252  virtual void DestroyWindow();
253  void InitializeApplication();
254  void CleanUpOffScreenRendering(void);
255  void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
256  void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
257  void CreateOffScreenWindow(int width,int height);
258  void SaveScreenRendering();
259  void CleanUpRenderers();
260  void VTKRegisterClass();
261 
262 private:
263  vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented.
264  void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented.
265 };
266 
267 
268 #endif
OpenGL rendering window.
virtual void SetOffScreenRendering(int)
virtual void Finalize()=0
virtual void SetWindowInfo(char *)=0
virtual void WindowRemap()=0
void PrintSelf(ostream &os, vtkIndent indent)
virtual void HideCursor()=0
#define VTKRENDERINGOPENGL2_EXPORT
static vtkRenderWindow * New()
virtual int * GetScreenSize()=0
virtual void SetWindowId(void *)=0
virtual void SetCurrentCursor(int)
virtual void SetNextWindowInfo(char *)=0
virtual void SetFullScreen(int)=0
virtual int GetEventPending()=0
virtual void SetSize(int, int)
virtual void SetStereoCapableWindow(int capable)
virtual const char * ReportCapabilities()
virtual int IsDirect()
virtual int SupportsOpenGL()
virtual void SetParentInfo(char *)=0
virtual bool IsCurrent()=0
virtual void SetParentId(void *)=0
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void DestroyWindow()=0
list of point or cell ids
Definition: vtkIdList.h:35
virtual void SetDisplayId(void *)=0
virtual void MakeCurrent()=0
virtual void SetNextWindowId(void *)=0
virtual void SetCursorPosition(int, int)
virtual int * GetPosition()
virtual void Frame()=0
virtual bool DetectDPI()
Definition: vtkWindow.h:139
virtual int * GetSize()
virtual bool InitializeFromCurrentContext()
virtual void Start()=0
virtual void SetWindowName(const char *)
virtual void SetPosition(int, int)
virtual void CreateAWindow()=0
virtual void ShowCursor()=0