VTK
vtkWin32OpenGLRenderWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkWin32OpenGLRenderWindow.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 =========================================================================*/
29 #ifndef vtkWin32OpenGLRenderWindow_h
30 #define vtkWin32OpenGLRenderWindow_h
31 
32 #include "vtkRenderingOpenGLModule.h" // For export macro
33 #include "vtkOpenGLRenderWindow.h"
34 
35 class vtkIdList;
36 
38 {
39 public:
42  void PrintSelf(ostream& os, vtkIndent indent);
43 
45  virtual void Start(void);
46 
48  void Frame(void);
49 
51  virtual void WindowInitialize(void);
52 
57  virtual void Initialize(void);
58 
63  virtual void Finalize(void);
64 
66  virtual void SetFullScreen(int);
67 
69  virtual void WindowRemap(void);
70 
72  virtual void PrefFullScreen(void);
73 
75 
76  virtual void SetSize(int width, int height);
77  virtual void SetSize(int a[2]) { vtkOpenGLRenderWindow::SetSize(a); }
79 
81  virtual int *GetSize();
82 
84 
85  virtual void SetPosition(int x, int y);
86  virtual void SetPosition(int a[2]) { vtkOpenGLRenderWindow::SetPosition(a); }
88 
90  virtual int *GetScreenSize();
91 
93  virtual int *GetPosition();
94 
97  virtual void SetWindowName(const char*);
98 
100  void SetWindowInfo(char*);
101 
103  void SetNextWindowInfo(char*);
104 
106  void SetParentInfo(char*);
107 
108  //BTX
109  virtual void *GetGenericDisplayId() { return (void*)this->ContextId; }
110  virtual void *GetGenericWindowId() { return (void*)this->WindowId; }
111  virtual void *GetGenericParentId() { return (void*)this->ParentId; }
112  virtual void *GetGenericContext() { return (void*)this->DeviceContext; }
113  virtual void *GetGenericDrawable() { return (void*)this->WindowId; }
114  virtual void SetDisplayId(void*);
115 
117  virtual HWND GetWindowId();
118 
120 
121  virtual void SetWindowId(HWND);
122  void SetWindowId(void *foo) { this->SetWindowId((HWND)foo); }
124 
127  virtual bool InitializeFromCurrentContext();
128 
130 
131  virtual void SetParentId(HWND);
132  void SetParentId(void *foo) { this->SetParentId((HWND)foo); }
134 
136  void SetContextId(HGLRC);
137 
139  void SetDeviceContext(HDC);
140 
142  virtual void SetNextWindowId(HWND);
143 
146  virtual void SetNextWindowId(void *arg);
147 
148  //ETX
149 
154  virtual void SetStereoCapableWindow(int capable);
155 
157  void MakeCurrent();
158 
161  virtual bool IsCurrent();
162 
164  const char *ReportCapabilities();
165 
167  int SupportsOpenGL();
168 
170  int IsDirect();
171 
175  virtual int GetEventPending();
176 
178 
180  void SetupMemoryRendering(int x, int y, HDC prn);
181  void SetupMemoryRendering(HBITMAP hbmp);
182  void ResumeScreenRendering(void);
183  HDC GetMemoryDC();
184  unsigned char *GetMemoryData() { return this->MemoryData; }
186 
188 
189  virtual void SetupPalette(HDC hDC);
190  virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug,
191  int bpp = 16, int zbpp = 16);
193 
195  void Clean();
196 
198 
200  void HideCursor();
201  void ShowCursor();
203 
205  void SetCursorPosition(int x, int y);
206 
208  virtual void SetCurrentCursor(int);
209 
210  virtual bool DetectDPI();
211 
214  virtual void SetOffScreenRendering(int offscreen);
215 
216 protected:
219 
221  HPALETTE Palette;
222  HPALETTE OldPalette;
223  HGLRC ContextId;
226  HWND WindowId;
227  HWND ParentId;
230  int ScreenSize[2];
231 
232  // the following is used to support rendering into memory
233  BITMAPINFO MemoryDataHeader;
234  HBITMAP MemoryBuffer;
235  unsigned char *MemoryData; // the data in the DIBSection
237 
239  int ScreenWindowSize[2];
243 
244  int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...)
245 
246  //BTX
247  // message handler
248  virtual LRESULT MessageProc(HWND hWnd, UINT message,
249  WPARAM wParam, LPARAM lParam);
250 
251  static LRESULT APIENTRY WndProc(HWND hWnd, UINT message,
252  WPARAM wParam, LPARAM lParam);
253  //ETX
256 
259  void ResizeWhileOffscreen(int xsize, int ysize);
260  virtual void CreateAWindow();
261  virtual void DestroyWindow();
262  void InitializeApplication();
263  void CleanUpOffScreenRendering(void);
264  void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
265  void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
266  void CreateOffScreenWindow(int width, int height);
267  void SaveScreenRendering();
268  void CleanUpRenderers();
269 
270 private:
271  vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented.
272  void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented.
273 };
274 
275 #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
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
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
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
#define VTKRENDERINGOPENGL_EXPORT
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:136
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