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);
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 
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 
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);
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();
264  void CreateOffScreenDC(int xsize, int ysize, HDC aHdc);
265  void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc);
269 
270 private:
271  vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&); // Not implemented.
272  void operator=(const vtkWin32OpenGLRenderWindow&); // Not implemented.
273 };
274 
275 #endif
vtkWin32OpenGLRenderWindow::GetGenericDrawable
virtual void * GetGenericDrawable()
Definition: vtkWin32OpenGLRenderWindow.h:113
vtkWin32OpenGLRenderWindow::InitializeApplication
void InitializeApplication()
vtkWin32OpenGLRenderWindow::PrefFullScreen
virtual void PrefFullScreen(void)
vtkWin32OpenGLRenderWindow::ResizeWhileOffscreen
void ResizeWhileOffscreen(int xsize, int ysize)
vtkWindow::SetSize
virtual void SetSize(int, int)
vtkWin32OpenGLRenderWindow::Initialize
virtual void Initialize(void)
vtkWin32OpenGLRenderWindow
OpenGL rendering window.
Definition: vtkWin32OpenGLRenderWindow.h:38
vtkWin32OpenGLRenderWindow::SetCurrentCursor
virtual void SetCurrentCursor(int)
vtkWin32OpenGLRenderWindow::SetNextWindowInfo
void SetNextWindowInfo(char *)
vtkWin32OpenGLRenderWindow::SupportsOpenGL
int SupportsOpenGL()
vtkWin32OpenGLRenderWindow::Palette
HPALETTE Palette
Definition: vtkWin32OpenGLRenderWindow.h:221
vtkWin32OpenGLRenderWindow::GetEventPending
virtual int GetEventPending()
vtkWin32OpenGLRenderWindow::GetGenericDisplayId
virtual void * GetGenericDisplayId()
Definition: vtkWin32OpenGLRenderWindow.h:109
vtkWin32OpenGLRenderWindow::ReportCapabilities
const char * ReportCapabilities()
vtkWin32OpenGLRenderWindow::NextWindowId
HWND NextWindowId
Definition: vtkWin32OpenGLRenderWindow.h:228
vtkWin32OpenGLRenderWindow::GetGenericParentId
virtual void * GetGenericParentId()
Definition: vtkWin32OpenGLRenderWindow.h:111
vtkWin32OpenGLRenderWindow::SetDeviceContext
void SetDeviceContext(HDC)
vtkWin32OpenGLRenderWindow::SetSize
virtual void SetSize(int width, int height)
vtkWin32OpenGLRenderWindow::SetStereoCapableWindow
virtual void SetStereoCapableWindow(int capable)
vtkWin32OpenGLRenderWindow::SetWindowId
void SetWindowId(void *foo)
Definition: vtkWin32OpenGLRenderWindow.h:122
vtkWin32OpenGLRenderWindow::MemoryBuffer
HBITMAP MemoryBuffer
Definition: vtkWin32OpenGLRenderWindow.h:234
vtkWin32OpenGLRenderWindow::SetWindowName
virtual void SetWindowName(const char *)
vtkWin32OpenGLRenderWindow::Frame
void Frame(void)
vtkRenderingOpenGLModule.h
vtkWin32OpenGLRenderWindow::ResumeScreenRendering
void ResumeScreenRendering(void)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkWin32OpenGLRenderWindow::WindowIdReferenceCount
int WindowIdReferenceCount
Definition: vtkWin32OpenGLRenderWindow.h:258
vtkWin32OpenGLRenderWindow::WindowId
HWND WindowId
Definition: vtkWin32OpenGLRenderWindow.h:226
vtkWin32OpenGLRenderWindow::~vtkWin32OpenGLRenderWindow
~vtkWin32OpenGLRenderWindow()
vtkWin32OpenGLRenderWindow::ContextId
HGLRC ContextId
Definition: vtkWin32OpenGLRenderWindow.h:223
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkWin32OpenGLRenderWindow::ApplicationInstance
HINSTANCE ApplicationInstance
Definition: vtkWin32OpenGLRenderWindow.h:220
vtkWin32OpenGLRenderWindow::GetMemoryDC
HDC GetMemoryDC()
vtkWin32OpenGLRenderWindow::IsDirect
int IsDirect()
vtkWin32OpenGLRenderWindow::SetNextWindowId
virtual void SetNextWindowId(void *arg)
vtkWin32OpenGLRenderWindow::WindowRemap
virtual void WindowRemap(void)
vtkWin32OpenGLRenderWindow::SetCursorPosition
void SetCursorPosition(int x, int y)
vtkWin32OpenGLRenderWindow::WndProc
static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
vtkWin32OpenGLRenderWindow::MessageProc
virtual LRESULT MessageProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
vtkgl::message
GLsizei GLenum GLuint GLuint GLsizei GLchar * message
Definition: vtkgl.h:19240
vtkWin32OpenGLRenderWindow::SetupMemoryRendering
void SetupMemoryRendering(HBITMAP hbmp)
vtkWin32OpenGLRenderWindow::Start
virtual void Start(void)
vtkWin32OpenGLRenderWindow::GetSize
virtual int * GetSize()
vtkWin32OpenGLRenderWindow::SetParentId
virtual void SetParentId(HWND)
vtkWin32OpenGLRenderWindow::HideCursor
void HideCursor()
vtkWin32OpenGLRenderWindow::SetupMemoryRendering
void SetupMemoryRendering(int x, int y, HDC prn)
vtkWin32OpenGLRenderWindow::SetWindowId
virtual void SetWindowId(HWND)
vtkWin32OpenGLRenderWindow::Capabilities
char * Capabilities
Definition: vtkWin32OpenGLRenderWindow.h:257
vtkOpenGLRenderWindow.h
vtkWin32OpenGLRenderWindow::ScreenMapped
int ScreenMapped
Definition: vtkWin32OpenGLRenderWindow.h:238
vtkWin32OpenGLRenderWindow::ParentId
HWND ParentId
Definition: vtkWin32OpenGLRenderWindow.h:227
vtkWin32OpenGLRenderWindow::GetGenericContext
virtual void * GetGenericContext()
Definition: vtkWin32OpenGLRenderWindow.h:112
vtkWin32OpenGLRenderWindow::CreatingOffScreenWindow
int CreatingOffScreenWindow
Definition: vtkWin32OpenGLRenderWindow.h:244
vtkgl::BOOL
const GLenum BOOL
Definition: vtkgl.h:11943
vtkWin32OpenGLRenderWindow::DetectDPI
virtual bool DetectDPI()
vtkWin32OpenGLRenderWindow::OldPalette
HPALETTE OldPalette
Definition: vtkWin32OpenGLRenderWindow.h:222
APIENTRY
#define APIENTRY
Definition: vtkgl.h:34
vtkWin32OpenGLRenderWindow::IsCurrent
virtual bool IsCurrent()
vtkWin32OpenGLRenderWindow::Clean
void Clean()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkWin32OpenGLRenderWindow::MemoryHdc
HDC MemoryHdc
Definition: vtkWin32OpenGLRenderWindow.h:236
vtkWin32OpenGLRenderWindow::SetContextId
void SetContextId(HGLRC)
vtkWin32OpenGLRenderWindow::ScreenContextId
HGLRC ScreenContextId
Definition: vtkWin32OpenGLRenderWindow.h:242
vtkWin32OpenGLRenderWindow::OwnWindow
int OwnWindow
Definition: vtkWin32OpenGLRenderWindow.h:229
vtkWin32OpenGLRenderWindow::Finalize
virtual void Finalize(void)
vtkWin32OpenGLRenderWindow::DestroyWindow
virtual void DestroyWindow()
vtkWin32OpenGLRenderWindow::SetOffScreenRendering
virtual void SetOffScreenRendering(int offscreen)
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkWin32OpenGLRenderWindow::SetupPixelFormat
virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug, int bpp=16, int zbpp=16)
vtkWin32OpenGLRenderWindow::SetNextWindowId
virtual void SetNextWindowId(HWND)
vtkWin32OpenGLRenderWindow::SetFullScreen
virtual void SetFullScreen(int)
vtkWin32OpenGLRenderWindow::ShowCursor
void ShowCursor()
vtkWin32OpenGLRenderWindow::DeviceContext
HDC DeviceContext
Definition: vtkWin32OpenGLRenderWindow.h:224
vtkWin32OpenGLRenderWindow::New
static vtkWin32OpenGLRenderWindow * New()
vtkWin32OpenGLRenderWindow::SetPosition
virtual void SetPosition(int a[2])
Definition: vtkWin32OpenGLRenderWindow.h:86
vtkWin32OpenGLRenderWindow::CreateOffScreenDC
void CreateOffScreenDC(int xsize, int ysize, HDC aHdc)
vtkgl::a
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
vtkWin32OpenGLRenderWindow::CreateOffScreenWindow
void CreateOffScreenWindow(int width, int height)
vtkWin32OpenGLRenderWindow::CleanUpOffScreenRendering
void CleanUpOffScreenRendering(void)
vtkgl::width
GLint GLint GLsizei width
Definition: vtkgl.h:11316
vtkWin32OpenGLRenderWindow::MemoryDataHeader
BITMAPINFO MemoryDataHeader
Definition: vtkWin32OpenGLRenderWindow.h:233
vtkWin32OpenGLRenderWindow::SetSize
virtual void SetSize(int a[2])
Definition: vtkWin32OpenGLRenderWindow.h:77
vtkWin32OpenGLRenderWindow::SetupPalette
virtual void SetupPalette(HDC hDC)
vtkWin32OpenGLRenderWindow::SetParentId
void SetParentId(void *foo)
Definition: vtkWin32OpenGLRenderWindow.h:132
vtkWin32OpenGLRenderWindow::GetWindowId
virtual HWND GetWindowId()
vtkWin32OpenGLRenderWindow::SetParentInfo
void SetParentInfo(char *)
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkWin32OpenGLRenderWindow::InitializeFromCurrentContext
virtual bool InitializeFromCurrentContext()
vtkWin32OpenGLRenderWindow::SaveScreenRendering
void SaveScreenRendering()
vtkWin32OpenGLRenderWindow::vtkWin32OpenGLRenderWindow
vtkWin32OpenGLRenderWindow()
vtkWin32OpenGLRenderWindow::MemoryData
unsigned char * MemoryData
Definition: vtkWin32OpenGLRenderWindow.h:235
vtkWin32OpenGLRenderWindow::MakeCurrent
void MakeCurrent()
vtkWin32OpenGLRenderWindow::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkWin32OpenGLRenderWindow::CreateOffScreenDC
void CreateOffScreenDC(HBITMAP hbmp, HDC aHdc)
vtkWin32OpenGLRenderWindow::GetMemoryData
unsigned char * GetMemoryData()
Definition: vtkWin32OpenGLRenderWindow.h:184
vtkWin32OpenGLRenderWindow::GetGenericWindowId
virtual void * GetGenericWindowId()
Definition: vtkWin32OpenGLRenderWindow.h:110
vtkWin32OpenGLRenderWindow::CursorHidden
int CursorHidden
Definition: vtkWin32OpenGLRenderWindow.h:254
vtkWin32OpenGLRenderWindow::CleanUpRenderers
void CleanUpRenderers()
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:41
vtkWin32OpenGLRenderWindow::ScreenDoubleBuffer
int ScreenDoubleBuffer
Definition: vtkWin32OpenGLRenderWindow.h:241
vtkWindow::SetPosition
virtual void SetPosition(int, int)
vtkWin32OpenGLRenderWindow::GetPosition
virtual int * GetPosition()
vtkWin32OpenGLRenderWindow::SetPosition
virtual void SetPosition(int x, int y)
vtkWin32OpenGLRenderWindow::ForceMakeCurrent
int ForceMakeCurrent
Definition: vtkWin32OpenGLRenderWindow.h:255
vtkWin32OpenGLRenderWindow::SetDisplayId
virtual void SetDisplayId(void *)
vtkWin32OpenGLRenderWindow::MFChandledWindow
BOOL MFChandledWindow
Definition: vtkWin32OpenGLRenderWindow.h:225
vtkWin32OpenGLRenderWindow::ScreenDeviceContext
HDC ScreenDeviceContext
Definition: vtkWin32OpenGLRenderWindow.h:240
vtkWin32OpenGLRenderWindow::CreateAWindow
virtual void CreateAWindow()
vtkWin32OpenGLRenderWindow::SetWindowInfo
void SetWindowInfo(char *)
vtkWin32OpenGLRenderWindow::GetScreenSize
virtual int * GetScreenSize()
vtkWin32OpenGLRenderWindow::WindowInitialize
virtual void WindowInitialize(void)
VTKRENDERINGOPENGL_EXPORT
#define VTKRENDERINGOPENGL_EXPORT
Definition: vtkRenderingOpenGLModule.h:15
vtkgl::height
GLint GLint GLsizei GLsizei height
Definition: vtkgl.h:11316