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 =========================================================================*/
26 #ifndef vtkWin32OpenGLRenderWindow_h
27 #define vtkWin32OpenGLRenderWindow_h
28 
29 #include "vtkRenderingOpenGLModule.h" // For export macro
30 #include "vtkOpenGLRenderWindow.h"
31 
32 class vtkIdList;
33 
35 {
36 public:
39  void PrintSelf(ostream& os, vtkIndent indent);
40 
42  virtual void Start(void);
43 
45  void Frame(void);
46 
48  virtual void WindowInitialize(void);
49 
54  virtual void Initialize(void);
55 
60  virtual void Finalize(void);
61 
63  virtual void SetFullScreen(int);
64 
66  virtual void WindowRemap(void);
67 
69  virtual void PrefFullScreen(void);
70 
72 
73  virtual void SetSize(int width, int height);
74  virtual void SetSize(int a[2]) { vtkOpenGLRenderWindow::SetSize(a); }
76 
78  virtual int *GetSize();
79 
81 
82  virtual void SetPosition(int x, int y);
83  virtual void SetPosition(int a[2]) { vtkOpenGLRenderWindow::SetPosition(a); }
85 
87  virtual int *GetScreenSize();
88 
90  virtual int *GetPosition();
91 
94  virtual void SetWindowName(const char*);
95 
97  void SetWindowInfo(char*);
98 
100  void SetNextWindowInfo(char*);
101 
103  void SetParentInfo(char*);
104 
105  //BTX
106  virtual void *GetGenericDisplayId() { return (void*)this->ContextId; }
107  virtual void *GetGenericWindowId() { return (void*)this->WindowId; }
108  virtual void *GetGenericParentId() { return (void*)this->ParentId; }
109  virtual void *GetGenericContext() { return (void*)this->DeviceContext; }
110  virtual void *GetGenericDrawable() { return (void*)this->WindowId; }
111  virtual void SetDisplayId(void*);
112 
114  virtual HWND GetWindowId();
115 
117 
118  virtual void SetWindowId(HWND);
119  void SetWindowId(void *foo) { this->SetWindowId((HWND)foo); }
121 
124  virtual bool InitializeFromCurrentContext();
125 
127 
128  virtual void SetParentId(HWND);
129  void SetParentId(void *foo) { this->SetParentId((HWND)foo); }
131 
133  void SetContextId(HGLRC);
134 
136  void SetDeviceContext(HDC);
137 
139  virtual void SetNextWindowId(HWND);
140 
143  virtual void SetNextWindowId(void *arg);
144 
145  //ETX
146 
151  virtual void SetStereoCapableWindow(int capable);
152 
154  void MakeCurrent();
155 
158  virtual bool IsCurrent();
159 
161  const char *ReportCapabilities();
162 
164  int SupportsOpenGL();
165 
167  int IsDirect();
168 
172  virtual int GetEventPending();
173 
175 
177  void SetupMemoryRendering(int x, int y, HDC prn);
178  void SetupMemoryRendering(HBITMAP hbmp);
179  void ResumeScreenRendering(void);
180  HDC GetMemoryDC();
181  unsigned char *GetMemoryData() { return this->MemoryData; }
183 
185 
186  virtual void SetupPalette(HDC hDC);
187  virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug,
188  int bpp = 16, int zbpp = 16);
190 
192  void Clean();
193 
195 
197  void HideCursor();
198  void ShowCursor();
200 
202  void SetCursorPosition(int x, int y);
203 
205  virtual void SetCurrentCursor(int);
206 
209  virtual void SetOffScreenRendering(int offscreen);
210 
211 protected:
214 
216  HPALETTE Palette;
217  HPALETTE OldPalette;
218  HGLRC ContextId;
221  HWND WindowId;
222  HWND ParentId;
225  int ScreenSize[2];
226 
227  // the following is used to support rendering into memory
228  BITMAPINFO MemoryDataHeader;
229  HBITMAP MemoryBuffer;
230  unsigned char *MemoryData; // the data in the DIBSection
232 
234  int ScreenWindowSize[2];
238 
239  int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...)
240 
241  //BTX
242  // message handler
243  virtual LRESULT MessageProc(HWND hWnd, UINT message,
244  WPARAM wParam, LPARAM lParam);
245 
246  static LRESULT APIENTRY WndProc(HWND hWnd, UINT message,
247  WPARAM wParam, LPARAM lParam);
248  //ETX
251 
254  void ResizeWhileOffscreen(int xsize, int ysize);
255  virtual void CreateAWindow();
256  virtual void DestroyWindow();
257  void InitializeApplication();
258  void CleanUpOffScreenRendering(void);
259  void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
260  void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
261  void CreateOffScreenWindow(int width, int height);
262  void SaveScreenRendering();
263  void CleanUpRenderers();
264 
265 private:
266  vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented.
267  void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented.
268 };
269 
270 #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
const GLenum BOOL
Definition: vtkgl.h:11943
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
virtual int GetEventPending()=0
virtual void SetSize(int, int)
GLint GLint GLsizei GLsizei height
Definition: vtkgl.h:11316
GLsizei GLenum GLuint GLuint GLsizei GLchar * message
Definition: vtkgl.h:19240
virtual void SetStereoCapableWindow(int capable)
virtual const char * ReportCapabilities()
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
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
GLint GLint GLsizei width
Definition: vtkgl.h:11316
virtual void MakeCurrent()=0
virtual void SetNextWindowId(void *)=0
virtual void SetCursorPosition(int, int)
virtual int * GetPosition()
virtual void Frame()=0
virtual int * GetSize()
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
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
#define APIENTRY
Definition: vtkgl.h:34