Equalizer  1.13.0
Parallel Rendering Framework
glx/window.h
1 
2 /* Copyright (c) 2005-2014, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2014, Daniel Nachbaur <danielnachbaur@gmail.com>
4  * 2009, 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 
49 # pragma clang diagnostic push
50 # pragma clang diagnostic ignored "-Woverloaded-virtual"
51 
52  virtual bool processEvent( const WindowEvent& event ) = 0;
53 # pragma clang diagnostic pop
54 };
55 
57 class Window : public WindowIF
58 {
59 public:
64  Window( NotifierInterface& parent, const WindowSettings& settings,
65  Display* xDisplay, const GLXEWContext* glxewContext,
66  MessagePump* messagePump );
67 
69  virtual ~Window();
70 
83  bool configInit() override;
84 
86  void configExit() override;
87 
96  virtual GLXFBConfig* chooseGLXFBConfig();
97 
107  virtual GLXContext createGLXContext( GLXFBConfig* fbConfig );
108 
119  virtual bool configInitGLXDrawable( GLXFBConfig* fbConfig );
120 
130  virtual bool configInitGLXWindow( GLXFBConfig* fbConfig );
131 
141  virtual bool configInitGLXPBuffer( GLXFBConfig* fbConfig );
142 
147  EQ_API virtual void initEventHandler();
148 
153  EQ_API virtual void exitEventHandler();
155 
159  EQ_API GLXContext getGLXContext() const override;
160 
162  EQ_API XID getXDrawable() const override;
163 
165  EQ_API Display* getXDisplay() override;
166 
168  EQ_API const GLXEWContext* glxewGetContext() const;
169 
179  virtual void setXDrawable( XID drawable );
180 
191  virtual void setGLXContext( GLXContext context );
193 
197  void makeCurrent( const bool cache = true ) const override;
198 
200  void doneCurrent() const override;
201 
203  void swapBuffers() override;
204 
206  void joinNVSwapBarrier( const uint32_t group,
207  const uint32_t barrier ) override;
208 
210  void leaveNVSwapBarrier();
211 
213  EQ_API bool processEvent( const WindowEvent& event ) override;
215 
216 private:
217  detail::Window* const _impl;
218 
220  XID _createGLXWindow( GLXFBConfig* fbConfig, const PixelViewport& pvp );
221 
223  void _initSwapSync();
224 };
225 }
226 }
227 #endif // EQ_GLX_WINDOW_H
EQ_API bool processEvent(const WindowEvent &event) override
virtual Display * getXDisplay()=0
bool configInit() override
Initialize this window for the glX window system.
virtual bool processEvent(const WindowEvent &event)=0
Process the given event.
Equalizer default implementation of a glX window.
Definition: glx/window.h:57
void joinNVSwapBarrier(const uint32_t group, const uint32_t barrier) override
Implementation untested for glX.
virtual GLXFBConfig * chooseGLXFBConfig()
Choose a GLX framebuffer config based on the window's attributes.
A message pump receiving and dispatching X11 events.
virtual bool configInitGLXWindow(GLXFBConfig *fbConfig)
Initialize the window with a window and bind the glX context.
EQ_API Display * getXDisplay() override
void leaveNVSwapBarrier()
Unbind a GLX_NV_swap_barrier.
virtual GLXContext createGLXContext(GLXFBConfig *fbConfig)
Create a glX context.
A set of settings to setup an eq::SystemWindow.
EQ_API XID getXDrawable() const override
virtual bool configInitGLXDrawable(GLXFBConfig *fbConfig)
Initialize the window's drawable (fullscreen, pbuffer or window) and bind the glX context...
void makeCurrent(const bool cache=true) const override
EQ_API const GLXEWContext * glxewGetContext() const
Window(NotifierInterface &parent, const WindowSettings &settings, Display *xDisplay, const GLXEWContext *glxewContext, MessagePump *messagePump)
Construct a new glX/X11 system window.
virtual EQ_API void exitEventHandler()
Deregister with the GLXEventHandler, called by setXDrawable().
EQ_API GLWindow(NotifierInterface &parent, const WindowSettings &settings)
Construct a new OpenGL window.
virtual bool configInitGLXPBuffer(GLXFBConfig *fbConfig)
Initialize the window with a PBuffer and bind the glX context.
A system window for OpenGL rendering.
Definition: glWindow.h:36
A base class for notifying errors and events.
void doneCurrent() const override
The Equalizer client library.
Definition: eq/agl/types.h:23
virtual ~Window()
Destruct this glX window.
virtual EQ_API void initEventHandler()
Register with the pipe's GLXEventHandler, called by setXDrawable().
virtual XID getXDrawable() const =0
virtual void setGLXContext(GLXContext context)
Set the glX rendering context for this window.
A window-system event for a glx::WindowIF.
void configExit() override
The interface defining the minimum functionality for a glX window.
Definition: glx/window.h:33
EQ_API GLXContext getGLXContext() const override
virtual GLXContext getGLXContext() const =0
void swapBuffers() override
virtual void setXDrawable(XID drawable)
Set the X11 drawable ID for this window.