Equalizer  2.1.0
Parallel Rendering Framework
agl/window.h
1 
2 /* Copyright (c) 2005-2016, 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_AGL_WINDOW_H
20 #define EQ_AGL_WINDOW_H
21 
22 #include <eq/defines.h>
23 #include <eq/os.h>
24 
25 #ifdef AGL
26 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
27 
28 #include <eq/agl/types.h>
29 #include <eq/glWindow.h> // base class
30 
31 namespace eq
32 {
33 namespace agl
34 {
35 namespace detail
36 {
37 class Window;
38 }
39 
41 class WindowIF : public GLWindow
42 {
43 public:
45  WindowIF(NotifierInterface& parent, const WindowSettings& settings)
46  : GLWindow(parent, settings)
47  {
48  }
49 
51  virtual ~WindowIF() {}
53  virtual AGLContext getAGLContext() const = 0;
54 
56  virtual WindowRef getCarbonWindow() const = 0;
57 
62  virtual bool isThreaded() const { return false; }
64  virtual bool processEvent(EventType type, EventRef)
65  {
66  return GLWindow::processEvent(type);
67  }
68 
70  virtual bool processEvent(EventType type, EventRef, SizeEvent& event)
71  {
72  return GLWindow::processEvent(type, event);
73  }
74 
76  virtual bool processEvent(EventType type, EventRef, PointerEvent& event)
77  {
78  return GLWindow::processEvent(type, event);
79  }
80 
82  virtual bool processEvent(EventType type, EventRef, KeyEvent& event)
83  {
84  return GLWindow::processEvent(type, event);
85  }
86 };
87 
89 class Window : public WindowIF
90 {
91 public:
100  EQ_API Window(NotifierInterface& parent, const WindowSettings& settings,
101  const CGDirectDisplayID displayID, const bool threaded);
102 
104  EQ_API virtual ~Window();
105 
117  EQ_API virtual void setAGLContext(AGLContext context);
118 
125  EQ_API virtual void setCarbonWindow(WindowRef window);
126 
128  EQ_API AGLContext getAGLContext() const override;
129 
131  EQ_API WindowRef getCarbonWindow() const override;
132 
137  EQ_API bool isThreaded() const override;
138 
140  CGDirectDisplayID getCGDisplayID() const;
142 
156  EQ_API bool configInit() override;
157 
159  EQ_API void configExit() override;
160 
173  EQ_API virtual AGLPixelFormat chooseAGLPixelFormat();
174 
184  EQ_API virtual void destroyAGLPixelFormat(AGLPixelFormat format);
185 
198  EQ_API virtual AGLContext createAGLContext(AGLPixelFormat format);
199 
209  EQ_API virtual bool configInitAGLDrawable();
210 
222  EQ_API virtual bool configInitAGLFullscreen();
223 
235  EQ_API virtual bool configInitAGLWindow();
236 
241  EQ_API virtual void initEventHandler();
242 
247  EQ_API virtual void exitEventHandler();
249 
253  EQ_API void makeCurrent(const bool cache = true) const override;
254 
256  EQ_API void doneCurrent() const override;
257 
259  EQ_API void swapBuffers() override;
260 
262  EQ_API void joinNVSwapBarrier(const uint32_t group,
263  const uint32_t barrier) override;
264 
265  EQ_API bool processEvent(EventType type, EventRef eventRef,
266  SizeEvent& event) override;
268 
269 private:
270  detail::Window* const _impl;
271 
272  void _initSwapSync(AGLContext context);
273  void _resize(const PixelViewport& pvp) override;
274 };
275 }
276 }
277 #endif // AGL
278 #endif // EQ_AGL_WINDOW_H
Includes compile-time defines of Equalizer.
Includes operating system headers for OpenGL and the used window system(s) correctly.
EQ_API bool processEvent(EventType type)
Process a stateless event.
The Equalizer client library.
Definition: eq/agl/types.h:23