Equalizer  2.0.0
Parallel Rendering Framework
glx/window.h
1 
2 /* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
3  * Daniel Nachbaur <danielnachbaur@gmail.com>
4  * Maxim Makhinya
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef EQ_GLX_WINDOW_H
21 #define EQ_GLX_WINDOW_H
22 
23 #include <eq/glx/types.h>
24 #include <eq/glWindow.h> // base class
25 
26 namespace eq
27 {
28 namespace glx
29 {
30 namespace detail { class Window; }
31 
33 class WindowIF : public GLWindow
34 {
35 public:
36  WindowIF( NotifierInterface& parent,
37  const WindowSettings& settings ) : GLWindow( parent, settings ) {}
38  virtual ~WindowIF() {}
39 
41  virtual GLXContext getGLXContext() const = 0;
42 
44  virtual XID getXDrawable() const = 0;
45 
47  virtual Display* getXDisplay() = 0;
48 
50  virtual bool processEvent( EventType type, const XEvent&,
51  SizeEvent& event )
52  { return GLWindow::processEvent( type, event ); }
53 
55  virtual bool processEvent( EventType type, const XEvent&,
56  PointerEvent& event )
57  { return GLWindow::processEvent( type, event ); }
58 
60  virtual bool processEvent( EventType type, const XEvent&, KeyEvent& event )
61  { return GLWindow::processEvent( type, event ); }
62 
64  virtual bool processEvent( EventType type, const XEvent&,
65  AxisEvent& event )
66  { return GLWindow::processEvent( type, event ); }
67 
69  virtual bool processEvent( EventType type, const XEvent&,
70  ButtonEvent& event )
71  { return GLWindow::processEvent( type, event ); }
72 
74  virtual bool processEvent( EventType, const XEvent& ) { return false; }
75 
76 };
77 
79 class Window : public WindowIF
80 {
81 public:
86  Window( NotifierInterface& parent, const WindowSettings& settings,
87  Display* xDisplay, const GLXEWContext* glxewContext,
88  MessagePump* messagePump );
89 
91  virtual ~Window();
92 
105  bool configInit() override;
106 
108  void configExit() override;
109 
118  virtual GLXFBConfig* chooseGLXFBConfig();
119 
129  virtual GLXContext createGLXContext( GLXFBConfig* fbConfig );
130 
141  virtual bool configInitGLXDrawable( GLXFBConfig* fbConfig );
142 
152  virtual bool configInitGLXWindow( GLXFBConfig* fbConfig );
153 
163  virtual bool configInitGLXPBuffer( GLXFBConfig* fbConfig );
164 
169  EQ_API virtual void initEventHandler();
170 
175  EQ_API virtual void exitEventHandler();
177 
181  EQ_API GLXContext getGLXContext() const override;
182 
184  EQ_API XID getXDrawable() const override;
185 
187  EQ_API Display* getXDisplay() override;
188 
190  EQ_API const GLXEWContext* glxewGetContext() const;
191 
201  virtual void setXDrawable( XID drawable );
202 
213  virtual void setGLXContext( GLXContext context );
215 
219  void makeCurrent( const bool cache = true ) const override;
220 
222  void doneCurrent() const override;
223 
225  void swapBuffers() override;
226 
228  void joinNVSwapBarrier( const uint32_t group,
229  const uint32_t barrier ) override;
230 
232  void leaveNVSwapBarrier();
233 
234  EQ_API bool processEvent( EventType type, const XEvent& xEvent,
235  PointerEvent& event ) override;
237 
238 private:
239  detail::Window* const _impl;
240 
242  XID _createGLXWindow( GLXFBConfig* fbConfig, const PixelViewport& pvp );
243 
245  void _initSwapSync();
246 };
247 }
248 }
249 #endif // EQ_GLX_WINDOW_H
Equalizer default implementation of a glX window.
Definition: glx/window.h:79
A message pump receiving and dispatching X11 events.
virtual bool processEvent(EventType type, const XEvent &, KeyEvent &event)
Process a keyboard event.
Definition: glx/window.h:60
A set of settings to setup an eq::SystemWindow.
virtual bool processEvent(EventType type, const XEvent &, SizeEvent &event)
Process a (re)size event.
Definition: glx/window.h:50
A system window for OpenGL rendering.
Definition: glWindow.h:36
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 bool processEvent(EventType type, const XEvent &, ButtonEvent &event)
Process a button event.
Definition: glx/window.h:69
virtual bool processEvent(EventType type, const XEvent &, PointerEvent &event)
Process a mouse event.
Definition: glx/window.h:55
The interface defining the minimum functionality for a glX window.
Definition: glx/window.h:33
virtual bool processEvent(EventType, const XEvent &)
Process a stateless event.
Definition: glx/window.h:74
virtual bool processEvent(EventType type, const XEvent &, AxisEvent &event)
Process an axis event.
Definition: glx/window.h:64