Equalizer  1.6.1
include/eq/client/agl/window.h
1 
2 /* Copyright (c) 2005-2012, 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/client/defines.h>
23 #ifdef AGL
24 
25 #include <eq/client/agl/types.h>
26 #include <eq/client/glWindow.h> // base class
27 
28 namespace eq
29 {
30 namespace agl
31 {
33  class WindowIF : public GLWindow
34  {
35  public:
37  WindowIF( eq::Window* parent ) : GLWindow( parent ) {}
38 
40  virtual ~WindowIF() {}
41 
43  EQ_API virtual AGLContext getAGLContext() const = 0;
44 
46  EQ_API virtual WindowRef getCarbonWindow() const = 0;
47 
49  EQ_API virtual AGLPbuffer getAGLPBuffer() const = 0;
50 
52  EQ_API virtual bool processEvent( const WindowEvent& event ) = 0;
53 
54  private:
55  struct Private;
56  Private* _private; // placeholder for binary-compatible changes
57  };
58 
60  class Window : public WindowIF
61  {
62  public:
71  EQ_API Window( eq::Window* parent, CGDirectDisplayID displayID = 0 );
72 
74  EQ_API virtual ~Window();
75 
87  EQ_API virtual void setAGLContext( AGLContext context );
88 
95  EQ_API virtual void setCarbonWindow( WindowRef window );
96 
103  EQ_API virtual void setAGLPBuffer( AGLPbuffer pbuffer );
104 
106  virtual AGLContext getAGLContext() const { return _aglContext; }
107 
109  virtual WindowRef getCarbonWindow() const { return _carbonWindow; }
110 
112  virtual AGLPbuffer getAGLPBuffer() const { return _aglPBuffer; }
113 
115  CGDirectDisplayID getCGDisplayID() const { return _cgDisplayID; }
117 
131  EQ_API virtual bool configInit();
132 
134  EQ_API virtual void configExit( );
135 
148  EQ_API virtual AGLPixelFormat chooseAGLPixelFormat();
149 
159  EQ_API virtual void destroyAGLPixelFormat( AGLPixelFormat format );
160 
173  EQ_API virtual AGLContext createAGLContext( AGLPixelFormat format );
174 
185  EQ_API virtual bool configInitAGLDrawable();
186 
198  EQ_API virtual bool configInitAGLFullscreen();
199 
211  EQ_API virtual bool configInitAGLWindow();
212 
221  EQ_API virtual bool configInitAGLPBuffer();
222 
227  EQ_API virtual void initEventHandler();
228 
233  EQ_API virtual void exitEventHandler();
235 
239  EQ_API virtual void makeCurrent( const bool cache = true ) const;
240 
242  EQ_API virtual void swapBuffers();
243 
245  EQ_API virtual void joinNVSwapBarrier( const uint32_t group,
246  const uint32_t barrier );
247 
249  EQ_API virtual bool processEvent( const WindowEvent& event );
251 
252  private:
254  AGLContext _aglContext;
255 
257  WindowRef _carbonWindow;
258 
260  AGLPbuffer _aglPBuffer;
261 
263  EventHandler* _eventHandler;
264 
266  CGDirectDisplayID _cgDisplayID;
267 
268  struct Private;
269  Private* _private; // placeholder for binary-compatible changes
270 
271  void _initSwapSync( AGLContext context );
272  };
273 }
274 }
275 #endif // AGL
276 #endif // EQ_AGL_WINDOW_H
virtual AGLContext getAGLContext() const =0
virtual AGLPbuffer getAGLPBuffer() const
virtual bool configInit()
Initialize this window for the AGL window system.
virtual void configExit()
virtual void initEventHandler()
Set up an AGLEventHandler, called by setCarbonWindow().
virtual AGLPbuffer getAGLPBuffer() const =0
A Window represents an on-screen or off-screen drawable.
Equalizer default implementation of an AGL window interface.
A system window for OpenGL rendering.
Definition: glWindow.h:33
CGDirectDisplayID getCGDisplayID() const
virtual WindowRef getCarbonWindow() const
virtual void joinNVSwapBarrier(const uint32_t group, const uint32_t barrier)
Not implemented for AGL.
virtual void setAGLPBuffer(AGLPbuffer pbuffer)
Set the AGL PBuffer object to be used with the current AGL context.
WindowIF(eq::Window *parent)
Construct a new AGL window for the given eq::Window.
virtual void exitEventHandler()
Destroy the AGLEventHandler, called by setCarbonWindow().
virtual bool processEvent(const WindowEvent &event)
virtual bool configInitAGLPBuffer()
Initialize the window with an offscreen AGL PBuffer.
The interface defining the minimum functionality for an AGL window.
virtual void makeCurrent(const bool cache=true) const
virtual bool configInitAGLFullscreen()
Initialize the window with a fullscreen Carbon window.
virtual ~Window()
Destruct the AGL window.
virtual bool processEvent(const WindowEvent &event)=0
Process the given event.
Window(eq::Window *parent, CGDirectDisplayID displayID=0)
Create a new AGL window for the given eq::Window.
The event handler for AGL windows.
virtual void swapBuffers()
virtual void setAGLContext(AGLContext context)
Set the AGL rendering context for this window.
virtual bool configInitAGLWindow()
Initialize the window with a normal Carbon window.
virtual void destroyAGLPixelFormat(AGLPixelFormat format)
Destroy a pixel format obtained with chooseAGLPixelFormat().
virtual AGLContext getAGLContext() const
virtual AGLPixelFormat chooseAGLPixelFormat()
Choose a pixel format based on the window&#39;s attributes.
A window-system event with the native Carbon event, used for AGL.
virtual WindowRef getCarbonWindow() const =0
virtual void setCarbonWindow(WindowRef window)
Set the carbon window to be used with the current AGL context.
virtual AGLContext createAGLContext(AGLPixelFormat format)
Create an AGL context.
virtual bool configInitAGLDrawable()
Initialize the window&#39;s drawable (fullscreen, pbuffer or window) and bind the AGL context...
virtual ~WindowIF()
Destruct the AGL window.