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 =========================================================================*/
32 #ifndef vtkWin32OpenGLRenderWindow_h
33 #define vtkWin32OpenGLRenderWindow_h
34 
35 #include "vtkRenderingOpenGLModule.h" // For export macro
36 #include "vtkOpenGLRenderWindow.h"
37 
38 class vtkIdList;
39 
40 class VTKRENDERINGOPENGL_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
48  virtual void Start(void);
49 
51  void Frame(void);
52 
54  virtual void WindowInitialize(void);
55 
60  virtual void Initialize(void);
61 
66  virtual void Finalize(void);
67 
69  virtual void SetFullScreen(int);
70 
72  virtual void WindowRemap(void);
73 
75  virtual void PrefFullScreen(void);
76 
78 
79  virtual void SetSize(int width, int height);
80  virtual void SetSize(int a[2]) { vtkOpenGLRenderWindow::SetSize(a); }
82 
84  virtual int *GetSize();
85 
87 
88  virtual void SetPosition(int x, int y);
89  virtual void SetPosition(int a[2]) { vtkOpenGLRenderWindow::SetPosition(a); }
91 
93  virtual int *GetScreenSize();
94 
96  virtual int *GetPosition();
97 
100  virtual void SetWindowName(const char*);
101 
103  void SetWindowInfo(char*);
104 
106  void SetNextWindowInfo(char*);
107 
109  void SetParentInfo(char*);
110 
111  //BTX
112  virtual void *GetGenericDisplayId() { return (void*)this->ContextId; }
113  virtual void *GetGenericWindowId() { return (void*)this->WindowId; }
114  virtual void *GetGenericParentId() { return (void*)this->ParentId; }
115  virtual void *GetGenericContext() { return (void*)this->DeviceContext; }
116  virtual void *GetGenericDrawable() { return (void*)this->WindowId; }
117  virtual void SetDisplayId(void*);
118 
120  virtual HWND GetWindowId();
121 
123 
124  virtual void SetWindowId(HWND);
125  void SetWindowId(void *foo) { this->SetWindowId((HWND)foo); }
127 
130  virtual bool InitializeFromCurrentContext();
131 
133 
134  virtual void SetParentId(HWND);
135  void SetParentId(void *foo) { this->SetParentId((HWND)foo); }
137 
139  void SetContextId(HGLRC);
140 
142  void SetDeviceContext(HDC);
143 
145  virtual void SetNextWindowId(HWND);
146 
149  virtual void SetNextWindowId(void *arg);
150 
151  //ETX
152 
157  virtual void SetStereoCapableWindow(int capable);
158 
160  void MakeCurrent();
161 
164  virtual bool IsCurrent();
165 
167  const char *ReportCapabilities();
168 
170  int SupportsOpenGL();
171 
173  int IsDirect();
174 
178  virtual int GetEventPending();
179 
181 
183  void SetupMemoryRendering(int x, int y, HDC prn);
184  void SetupMemoryRendering(HBITMAP hbmp);
185  void ResumeScreenRendering(void);
186  HDC GetMemoryDC();
187  unsigned char *GetMemoryData() { return this->MemoryData; }
189 
191 
192  virtual void SetupPalette(HDC hDC);
193  virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug,
194  int bpp = 16, int zbpp = 16);
196 
198  void Clean();
199 
201 
203  void HideCursor();
204  void ShowCursor();
206 
208  void SetCursorPosition(int x, int y);
209 
211  virtual void SetCurrentCursor(int);
212 
213  virtual bool DetectDPI();
214 
217  virtual void SetOffScreenRendering(int offscreen);
218 
219 protected:
222 
224  HPALETTE Palette;
225  HPALETTE OldPalette;
226  HGLRC ContextId;
229  HWND WindowId;
230  HWND ParentId;
233  int ScreenSize[2];
234 
235  // the following is used to support rendering into memory
236  BITMAPINFO MemoryDataHeader;
237  HBITMAP MemoryBuffer;
238  unsigned char *MemoryData; // the data in the DIBSection
240 
242  int ScreenWindowSize[2];
246 
247  int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...)
248 
249  //BTX
250  // message handler
251  virtual LRESULT MessageProc(HWND hWnd, UINT message,
252  WPARAM wParam, LPARAM lParam);
253 
254  static LRESULT APIENTRY WndProc(HWND hWnd, UINT message,
255  WPARAM wParam, LPARAM lParam);
256  //ETX
259 
262  void ResizeWhileOffscreen(int xsize, int ysize);
263  virtual void CreateAWindow();
264  virtual void DestroyWindow();
265  void InitializeApplication();
266  void CleanUpOffScreenRendering(void);
267  void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
268  void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
269  void CreateOffScreenWindow(int width, int height);
270  void SaveScreenRendering();
271  void CleanUpRenderers();
272 
273 private:
274  vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented.
275  void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented.
276 };
277 
278 #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
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