Equalizer  2.1.0
Parallel Rendering Framework
wgl/window.h
1 
2 /* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
3  * Maxim Makhinya
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef EQ_WGL_WINDOW_H
20 #define EQ_WGL_WINDOW_H
21 
22 #include <eq/glWindow.h> // base class
23 #include <eq/os.h>
24 #include <eq/wgl/types.h>
25 
26 namespace eq
27 {
28 namespace wgl
29 {
30 namespace detail
31 {
32 class Window;
33 }
34 
36 class WindowIF : public GLWindow
37 {
38 public:
40  WindowIF(NotifierInterface& parent, const WindowSettings& settings)
41  : GLWindow(parent, settings)
42  {
43  }
44 
46  virtual ~WindowIF() {}
48  EQ_API virtual HGLRC getWGLContext() const = 0;
49 
51  EQ_API virtual HWND getWGLWindowHandle() const = 0;
52 
57  EQ_API virtual HDC getWGLDC() const = 0;
58 
60  virtual HDC getWGLAffinityDC() { return 0; }
62  virtual bool processEvent(EventType type, SizeEvent& event)
63  {
64  return GLWindow::processEvent(type, event);
65  }
66 
68  virtual bool processEvent(EventType type, PointerEvent& event)
69  {
70  return GLWindow::processEvent(type, event);
71  }
72 
74  virtual bool processEvent(EventType type, KeyEvent& event)
75  {
76  return GLWindow::processEvent(type, event);
77  }
78 
80  virtual bool processEvent(AxisEvent& event)
81  {
82  return GLWindow::processEvent(event);
83  }
84 
86  virtual bool processEvent(ButtonEvent& event)
87  {
88  return GLWindow::processEvent(event);
89  }
90 
92  virtual bool processEvent(EventType) { return false; }
93 };
94 
96 class Window : public WindowIF
97 {
98 public:
100  EQ_API Window(NotifierInterface& parent, const WindowSettings& settings,
101  Pipe& pipe);
102 
104  EQ_API virtual ~Window();
105 
117  EQ_API virtual void setWGLContext(HGLRC context);
118 
120 
129  EQ_API virtual void setWGLWindowHandle(HWND handle);
130 
132  EQ_API virtual HWND getWGLWindowHandle() const;
133 
138  EQ_API virtual HDC getWGLDC() const;
139 
141  EQ_API virtual HGLRC getWGLContext() const;
142 
144  EQ_API const EventHandler* getWGLEventHandler() const;
146 
160  EQ_API virtual bool configInit();
161 
163  EQ_API virtual void configExit();
164 
171  EQ_API virtual bool initWGLAffinityDC();
172 
174  EQ_API virtual void exitWGLAffinityDC();
175 
177  EQ_API virtual HDC getWGLAffinityDC();
178 
188  EQ_API virtual HDC createWGLDisplayDC();
189 
199  EQ_API virtual int chooseWGLPixelFormat();
200 
210  EQ_API virtual bool configInitWGLDrawable(int pixelFormat);
211 
221  EQ_API virtual bool configInitWGLWindow(int pixelFormat);
222 
224  EQ_API virtual bool configInitWGLFBO(int pixelFormat);
225 
234  EQ_API virtual HGLRC createWGLContext();
235 
237  EQ_API virtual void destroyWGLContext(HGLRC context);
238 
243  EQ_API virtual void initEventHandler();
244 
249  EQ_API virtual void exitEventHandler();
251 
255  EQ_API virtual void makeCurrent(const bool cache = true) const;
256 
258  EQ_API virtual void doneCurrent() const;
259 
261  EQ_API virtual void swapBuffers();
262 
264  EQ_API virtual void joinNVSwapBarrier(const uint32_t group,
265  const uint32_t barrier);
266 
268  void leaveNVSwapBarrier();
269 
270  EQ_API bool processEvent(EventType type, PointerEvent& event) override;
271  EQ_API bool processEvent(EventType type) override;
273 
274 protected:
276  EQ_API WGLEWContext* wglewGetContext();
277 
278 private:
279  detail::Window* const _impl;
280 
282  HWND _createWGLWindow(const PixelViewport& pvp);
283 
285  int _chooseWGLPixelFormatARB(HDC pfDC);
286 
288  int _chooseWGLPixelFormat(HDC pfDC);
289 
290  void _initSwapSync();
291  void _resize(const PixelViewport& pvp) override;
292 };
293 }
294 }
295 #endif // EQ_WGL_WINDOW_H
The interface defining the minimum functionality for a WGL window.
Definition: wgl/window.h:36
Equalizer default implementation of a WGL window.
Definition: wgl/window.h:96
virtual ~WindowIF()
Destruct the WGL window.
Definition: wgl/window.h:46
A set of settings to setup an eq::SystemWindow.
virtual bool processEvent(EventType type, PointerEvent &event)
Process a mouse event.
Definition: wgl/window.h:68
Equalizer default implementation of a WGL GPU.
Definition: wgl/pipe.h:32
The event handler for WGL.
virtual bool processEvent(ButtonEvent &event)
Process a button event.
Definition: wgl/window.h:86
virtual bool processEvent(EventType)
Process a stateless event.
Definition: wgl/window.h:92
WindowIF(NotifierInterface &parent, const WindowSettings &settings)
Construct a new WGL window for the given eq::Window.
Definition: wgl/window.h:40
Includes operating system headers for OpenGL and the used window system(s) correctly.
A system window for OpenGL rendering.
Definition: glWindow.h:39
A base class for notifying errors and events.
EQ_API bool processEvent(EventType type)
Process a stateless event.
The Equalizer client library.
Definition: eq/agl/types.h:23
virtual HDC getWGLAffinityDC()
Definition: wgl/window.h:60
virtual bool processEvent(EventType type, SizeEvent &event)
Process a (re)size event.
Definition: wgl/window.h:62
virtual bool processEvent(EventType type, KeyEvent &event)
Process a keyboard event.
Definition: wgl/window.h:74
virtual bool processEvent(AxisEvent &event)
Process an axis event.
Definition: wgl/window.h:80