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 "vtkOpenGLRenderWindow.h"
36 
37 class vtkIdList;
38 
40 {
41 public:
44  void PrintSelf(ostream& os, vtkIndent indent);
45 
47  virtual void Start(void);
48 
50  void Frame(void);
51 
53  virtual void WindowInitialize(void);
54 
59  virtual void Initialize(void);
60 
65  virtual void Finalize(void);
66 
68  virtual void SetFullScreen(int);
69 
71  virtual void WindowRemap(void);
72 
74  virtual void PrefFullScreen(void);
75 
77 
78  virtual void SetSize(int,int);
79  virtual void SetSize(int a[2]) {vtkOpenGLRenderWindow::SetSize(a);};
81 
83  virtual int *GetSize();
84 
86 
87  virtual void SetPosition(int,int);
88  virtual void SetPosition(int a[2]) {vtkOpenGLRenderWindow::SetPosition(a);};
90 
92  virtual int *GetScreenSize();
93 
95  virtual int *GetPosition();
96 
99  virtual void SetWindowName(const char *);
100 
102  void SetWindowInfo(char *);
103 
105  void SetNextWindowInfo(char *);
106 
108  void SetParentInfo(char *);
109 
110  //BTX
111  virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
112  virtual void *GetGenericWindowId() {return (void *)this->WindowId;};
113  virtual void *GetGenericParentId() {return (void *)this->ParentId;};
114  virtual void *GetGenericContext() {return (void *)this->DeviceContext;};
115  virtual void *GetGenericDrawable() {return (void *)this->WindowId;};
116  virtual void SetDisplayId(void *);
117 
119 
120  virtual HWND GetWindowId();
121  void SetWindowId(void *foo) {this->SetWindowId((HWND)foo);};
123 
125  virtual void SetWindowId(HWND);
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 
143  //ETX
144 
149  virtual void SetStereoCapableWindow(int capable);
150 
152  void MakeCurrent();
153 
156  virtual bool IsCurrent();
157 
159  const char *ReportCapabilities();
160 
162  int SupportsOpenGL();
163 
165  int IsDirect();
166 
170  virtual int GetEventPending();
171 
173 
175  void SetupMemoryRendering(int x, int y, HDC prn);
176  void SetupMemoryRendering(HBITMAP hbmp);
177  void ResumeScreenRendering(void);
178  HDC GetMemoryDC();
179  unsigned char *GetMemoryData(){return this->MemoryData;};
181 
183 
184  virtual void SetupPalette(HDC hDC);
185  virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug,
186  int bpp=16, int zbpp=16);
188 
190  void Clean();
191 
193 
196  void HideCursor();
197  void ShowCursor();
198  void SetCursorPosition(int x, int y);
200 
202  virtual void SetCurrentCursor(int);
203 
206  virtual void SetOffScreenRendering(int offscreen);
207 
208 protected:
211 
213  HPALETTE Palette;
214  HPALETTE OldPalette;
215  HGLRC ContextId;
218  HWND WindowId;
219  HWND ParentId;
222  int ScreenSize[2];
223 
224  // the following is used to support rendering into memory
225  BITMAPINFO MemoryDataHeader;
226  HBITMAP MemoryBuffer;
227  unsigned char *MemoryData; // the data in the DIBSection
229 
231  int ScreenWindowSize[2];
235 
236  int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...)
237 
238  //BTX
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  //ETX
248 
251  void ResizeWhileOffscreen(int xsize, int ysize);
252  virtual void CreateAWindow();
253  virtual void DestroyWindow();
254  void InitializeApplication();
255  void CleanUpOffScreenRendering(void);
256  void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
257  void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
258  void CreateOffScreenWindow(int width,int height);
259  void SaveScreenRendering();
260  void CleanUpRenderers();
261 
262 private:
263  vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented.
264  void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented.
265 };
266 
267 
268 #endif
269