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 "vtkOpenGLRenderWindow.h"
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  //BTX
108  virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
109  virtual void *GetGenericWindowId() {return (void *)this->WindowId;};
110  virtual void *GetGenericParentId() {return (void *)this->ParentId;};
111  virtual void *GetGenericContext() {return (void *)this->DeviceContext;};
112  virtual void *GetGenericDrawable() {return (void *)this->WindowId;};
113  virtual void SetDisplayId(void *);
114 
116 
117  virtual HWND GetWindowId();
118  void SetWindowId(void *foo) {this->SetWindowId((HWND)foo);};
120 
122  virtual void SetWindowId(HWND);
123 
125 
126  virtual void SetParentId(HWND);
127  void SetParentId(void *foo) {this->SetParentId((HWND)foo);};
129 
130  void SetContextId(HGLRC); // hsr
131  void SetDeviceContext(HDC); // hsr
132 
134  virtual void SetNextWindowId(HWND);
135 
138  virtual void SetNextWindowId(void *arg);
139 
140  //ETX
141 
146  virtual void SetStereoCapableWindow(int capable);
147 
149  void MakeCurrent();
150 
153  virtual bool IsCurrent();
154 
156  const char *ReportCapabilities();
157 
159  int SupportsOpenGL();
160 
162  int IsDirect();
163 
167  virtual int GetEventPending();
168 
170 
172  void SetupMemoryRendering(int x, int y, HDC prn);
173  void SetupMemoryRendering(HBITMAP hbmp);
174  void ResumeScreenRendering(void);
175  HDC GetMemoryDC();
176  unsigned char *GetMemoryData(){return this->MemoryData;};
178 
180 
181  virtual void SetupPalette(HDC hDC);
182  virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug,
183  int bpp=16, int zbpp=16);
185 
187  void Clean();
188 
190 
193  void HideCursor();
194  void ShowCursor();
195  void SetCursorPosition(int x, int y);
197 
199  virtual void SetCurrentCursor(int);
200 
203  virtual void SetOffScreenRendering(int offscreen);
204 
205 protected:
208 
210  HPALETTE Palette;
211  HPALETTE OldPalette;
212  HGLRC ContextId;
215  HWND WindowId;
216  HWND ParentId;
219  int ScreenSize[2];
220 
221  // the following is used to support rendering into memory
222  BITMAPINFO MemoryDataHeader;
223  HBITMAP MemoryBuffer;
224  unsigned char *MemoryData; // the data in the DIBSection
226 
228  int ScreenWindowSize[2];
232 
233  int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...)
234 
235  //BTX
236  // message handler
237  virtual LRESULT MessageProc(HWND hWnd, UINT message,
238  WPARAM wParam, LPARAM lParam);
239 
240  static LRESULT APIENTRY WndProc(HWND hWnd, UINT message,
241  WPARAM wParam, LPARAM lParam);
242  //ETX
245 
248  void ResizeWhileOffscreen(int xsize, int ysize);
249  virtual void CreateAWindow();
250  virtual void DestroyWindow();
251  void InitializeApplication();
252  void CleanUpOffScreenRendering(void);
253  void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
254  void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
255  void CreateOffScreenWindow(int width,int height);
256  void SaveScreenRendering();
257  void CleanUpRenderers();
258 
259 private:
260  vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented.
261  void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented.
262 };
263 
264 
265 #endif
266 
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:37
virtual void DestroyWindow()=0
list of point or cell ids
Definition: vtkIdList.h:34
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
#define VTK_RENDERING_EXPORT
virtual int * GetSize()
virtual void Start()=0
virtual void SetWindowName(const char *)
virtual void SetPosition(int, int)
virtual void CreateAWindow()=0
virtual void ShowCursor()=0