Equalizer  1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
client/agl/window.h
1 
2 /* Copyright (c) 2005-2014, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2010, 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 #ifdef AGL
24 
25 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
26 
27 #include <eq/client/agl/types.h>
28 #include <eq/client/glWindow.h> // base class
29 
30 namespace eq
31 {
32 namespace agl
33 {
34 namespace detail { class Window; }
35 
37 class WindowIF : public GLWindow
38 {
39 public:
41  WindowIF( NotifierInterface& parent, const WindowSettings& settings )
42  : GLWindow( parent, settings ) {}
43 
45  virtual ~WindowIF() {}
46 
48  virtual AGLContext getAGLContext() const = 0;
49 
51  virtual WindowRef getCarbonWindow() const = 0;
52 
54  virtual AGLPbuffer getAGLPBuffer() const = 0;
55 
60  virtual bool isThreaded() const { return false; }
61 
62 # pragma clang diagnostic push
63 # pragma clang diagnostic ignored "-Woverloaded-virtual"
64 
65  EQ_API virtual bool processEvent( const WindowEvent& event ) = 0;
66 # pragma clang diagnostic pop
67 };
68 
70 class Window : public WindowIF
71 {
72 public:
81  EQ_API Window( NotifierInterface& parent, const WindowSettings& settings,
82  const CGDirectDisplayID displayID, const bool threaded );
83 
85  EQ_API virtual ~Window();
86 
98  EQ_API virtual void setAGLContext( AGLContext context );
99 
106  EQ_API virtual void setCarbonWindow( WindowRef window );
107 
114  EQ_API virtual void setAGLPBuffer( AGLPbuffer pbuffer );
115 
117  EQ_API AGLContext getAGLContext() const override;
118 
120  EQ_API WindowRef getCarbonWindow() const override;
121 
123  EQ_API AGLPbuffer getAGLPBuffer() const override;
124 
129  EQ_API bool isThreaded() const override;
130 
132  CGDirectDisplayID getCGDisplayID() const;
134 
148  EQ_API virtual bool configInit();
149 
151  EQ_API virtual void configExit( );
152 
165  EQ_API virtual AGLPixelFormat chooseAGLPixelFormat();
166 
176  EQ_API virtual void destroyAGLPixelFormat( AGLPixelFormat format );
177 
190  EQ_API virtual AGLContext createAGLContext( AGLPixelFormat format );
191 
202  EQ_API virtual bool configInitAGLDrawable();
203 
215  EQ_API virtual bool configInitAGLFullscreen();
216 
228  EQ_API virtual bool configInitAGLWindow();
229 
238  EQ_API virtual bool configInitAGLPBuffer();
239 
244  EQ_API virtual void initEventHandler();
245 
250  EQ_API virtual void exitEventHandler();
252 
256  EQ_API virtual void makeCurrent( const bool cache = true ) const;
257 
259  EQ_API virtual void swapBuffers();
260 
262  EQ_API virtual void joinNVSwapBarrier( const uint32_t group,
263  const uint32_t barrier );
264 
266  EQ_API virtual bool processEvent( const WindowEvent& event );
268 
269 private:
270  detail::Window* const _impl;
271 
272  void _initSwapSync( AGLContext context );
273 };
274 }
275 }
276 #endif // AGL
277 #endif // EQ_AGL_WINDOW_H