Equalizer  2.0.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 { class Window; }
36 
38 class WindowIF : public GLWindow
39 {
40 public:
42  WindowIF( NotifierInterface& parent, const WindowSettings& settings )
43  : GLWindow( parent, settings ) {}
44 
46  virtual ~WindowIF() {}
47 
49  virtual AGLContext getAGLContext() const = 0;
50 
52  virtual WindowRef getCarbonWindow() const = 0;
53 
55  virtual AGLPbuffer getAGLPBuffer() const = 0;
56 
61  virtual bool isThreaded() const { return false; }
62 
64  virtual bool processEvent( EventType type, EventRef )
65  { return GLWindow::processEvent( type ); }
66 
68  virtual bool processEvent( EventType type, EventRef, SizeEvent& event )
69  { return GLWindow::processEvent( type, event ); }
70 
72  virtual bool processEvent( EventType type, EventRef, PointerEvent& event )
73  { return GLWindow::processEvent( type, event ); }
74 
76  virtual bool processEvent( EventType type, EventRef, KeyEvent& event )
77  { return GLWindow::processEvent( type, event ); }
78 };
79 
81 class Window : public WindowIF
82 {
83 public:
92  EQ_API Window( NotifierInterface& parent, const WindowSettings& settings,
93  const CGDirectDisplayID displayID, const bool threaded );
94 
96  EQ_API virtual ~Window();
97 
109  EQ_API virtual void setAGLContext( AGLContext context );
110 
117  EQ_API virtual void setCarbonWindow( WindowRef window );
118 
125  EQ_API virtual void setAGLPBuffer( AGLPbuffer pbuffer );
126 
128  EQ_API AGLContext getAGLContext() const override;
129 
131  EQ_API WindowRef getCarbonWindow() const override;
132 
134  EQ_API AGLPbuffer getAGLPBuffer() const override;
135 
140  EQ_API bool isThreaded() const override;
141 
143  CGDirectDisplayID getCGDisplayID() const;
145 
159  EQ_API bool configInit() override;
160 
162  EQ_API void configExit() override;
163 
176  EQ_API virtual AGLPixelFormat chooseAGLPixelFormat();
177 
187  EQ_API virtual void destroyAGLPixelFormat( AGLPixelFormat format );
188 
201  EQ_API virtual AGLContext createAGLContext( AGLPixelFormat format );
202 
213  EQ_API virtual bool configInitAGLDrawable();
214 
226  EQ_API virtual bool configInitAGLFullscreen();
227 
239  EQ_API virtual bool configInitAGLWindow();
240 
249  EQ_API virtual bool configInitAGLPBuffer();
250 
255  EQ_API virtual void initEventHandler();
256 
261  EQ_API virtual void exitEventHandler();
263 
267  EQ_API void makeCurrent( const bool cache = true ) const override;
268 
270  EQ_API void doneCurrent() const override;
271 
273  EQ_API void swapBuffers() override;
274 
276  EQ_API void joinNVSwapBarrier( const uint32_t group,
277  const uint32_t barrier ) override;
278 
279  EQ_API bool processEvent( EventType type, EventRef eventRef,
280  SizeEvent& event ) override;
282 
283 private:
284  detail::Window* const _impl;
285 
286  void _initSwapSync( AGLContext context );
287 };
288 }
289 }
290 #endif // AGL
291 #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