Equalizer  1.6.1
include/eq/client/glx/window.h
1 
2 /* Copyright (c) 2005-2012, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2009, 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_GLX_WINDOW_H
20 #define EQ_GLX_OS_WINDOW_H
21 
22 #include <eq/client/glx/types.h>
23 #include <eq/client/glWindow.h> // base class
24 
25 namespace eq
26 {
27 namespace glx
28 {
30  class WindowIF : public GLWindow
31  {
32  public:
33  WindowIF( eq::Window* parent ) : GLWindow( parent ) {}
34  virtual ~WindowIF() {}
35 
37  virtual GLXContext getGLXContext() const = 0;
38 
40  virtual XID getXDrawable() const = 0;
41 
43  virtual Display* getXDisplay() = 0;
44 
46  EQ_API virtual bool processEvent( const WindowEvent& event ) = 0;
47  };
48 
50  class Window : public WindowIF
51  {
52  public:
61  Window( eq::Window* parent, Display* xDisplay = 0,
62  GLXEWContext* glxewContext = 0 );
63 
65  virtual ~Window();
66 
79  virtual bool configInit();
80 
82  virtual void configExit();
83 
92  virtual GLXFBConfig* chooseGLXFBConfig();
93 
103  virtual GLXContext createGLXContext( GLXFBConfig* fbConfig );
104 
115  virtual bool configInitGLXDrawable( GLXFBConfig* fbConfig );
116 
126  virtual bool configInitGLXWindow( GLXFBConfig* fbConfig );
127 
137  virtual bool configInitGLXPBuffer( GLXFBConfig* fbConfig );
138 
143  EQ_API virtual void initEventHandler();
144 
149  EQ_API virtual void exitEventHandler();
151 
155  virtual GLXContext getGLXContext() const { return _glXContext; }
156 
158  virtual XID getXDrawable() const { return _xDrawable; }
159 
161  virtual Display* getXDisplay() { return _xDisplay; }
162 
164  GLXEWContext* glxewGetContext() { return _glxewContext; }
165 
175  virtual void setXDrawable( XID drawable );
176 
187  virtual void setGLXContext( GLXContext context );
189 
193  virtual void makeCurrent( const bool cache = true ) const;
194 
196  virtual void swapBuffers();
197 
199  virtual void joinNVSwapBarrier( const uint32_t group,
200  const uint32_t barrier );
201 
203  void leaveNVSwapBarrier();
204 
206  EQ_API virtual bool processEvent( const WindowEvent& event );
208 
209  private:
211  Display* _xDisplay;
213  XID _xDrawable;
215  GLXContext _glXContext;
217  uint32_t _glXNVSwapGroup;
218 
220  EventHandler* _glXEventHandler;
221 
223  GLXEWContext* _glxewContext;
224 
225  struct Private;
226  Private* _private; // placeholder for binary-compatible changes
227 
229  XID _createGLXWindow( GLXFBConfig* fbConfig, const PixelViewport& pvp );
230 
232  void _initSwapSync();
233  };
234 }
235 }
236 #endif // EQ_GLX_OS_WINDOW_H
237 
virtual bool configInitGLXWindow(GLXFBConfig *fbConfig)
Initialize the window with a window and bind the glX context.
virtual bool configInitGLXPBuffer(GLXFBConfig *fbConfig)
Initialize the window with a PBuffer and bind the glX context.
Window(eq::Window *parent, Display *xDisplay=0, GLXEWContext *glxewContext=0)
Construct a new glX/X11 system window.
virtual XID getXDrawable() const =0
A Window represents an on-screen or off-screen drawable.
virtual XID getXDrawable() const
virtual GLXContext createGLXContext(GLXFBConfig *fbConfig)
Create a glX context.
virtual void makeCurrent(const bool cache=true) const
void leaveNVSwapBarrier()
Unbind a GLX_NV_swap_barrier.
virtual bool configInit()
Initialize this window for the glX window system.
virtual GLXContext getGLXContext() const =0
virtual bool processEvent(const WindowEvent &event)
A system window for OpenGL rendering.
Definition: glWindow.h:33
virtual void setXDrawable(XID drawable)
Set the X11 drawable ID for this window.
virtual Display * getXDisplay()
GLWindow(Window *parent)
Construct a new OpenGL window.
virtual ~Window()
Destruct this glX window.
virtual void exitEventHandler()
Deregister with the GLXEventHandler, called by setXDrawable().
virtual void swapBuffers()
virtual void initEventHandler()
Register with the pipe&#39;s GLXEventHandler, called by setXDrawable().
Equalizer default implementation of a glX window.
virtual void setGLXContext(GLXContext context)
Set the glX rendering context for this window.
virtual GLXContext getGLXContext() const
virtual bool processEvent(const WindowEvent &event)=0
Process the given event.
The event handler for glX/X11 windows.
virtual void joinNVSwapBarrier(const uint32_t group, const uint32_t barrier)
Implementation untested for glX.
The interface defining the minimum functionality for a glX window.
virtual bool configInitGLXDrawable(GLXFBConfig *fbConfig)
Initialize the window&#39;s drawable (fullscreen, pbuffer or window) and bind the glX context...
A window-system event for a glx::WindowIF.
virtual GLXFBConfig * chooseGLXFBConfig()
Choose a GLX framebuffer config based on the window&#39;s attributes.
virtual Display * getXDisplay()=0
virtual void configExit()
GLXEWContext * glxewGetContext()