Equalizer  1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
client/wgl/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_WGL_WINDOW_H
20 #define EQ_WGL_WINDOW_H
21 
22 #include <eq/client/glWindow.h> // base class
23 #include <eq/client/gl.h> // for HPBUFFERARB from wglew.h
24 #include <eq/client/wgl/types.h>
25 
26 namespace eq
27 {
28 namespace wgl
29 {
30 namespace detail { class Window; }
31 
33 class WindowIF : public GLWindow
34 {
35 public:
37  WindowIF( NotifierInterface& parent, const WindowSettings& settings )
38  : GLWindow( parent, settings ) {}
39 
41  virtual ~WindowIF() {}
42 
44  EQ_API virtual HGLRC getWGLContext() const = 0;
45 
47  EQ_API virtual HWND getWGLWindowHandle() const = 0;
48 
50  EQ_API virtual HPBUFFERARB getWGLPBufferHandle() const = 0;
51 
56  EQ_API virtual HDC getWGLDC() const = 0;
57 
59  virtual HDC getWGLAffinityDC() { return 0; }
60 
62  EQ_API virtual bool processEvent( const WindowEvent& event ) = 0;
63 };
64 
66 class Window : public WindowIF
67 {
68 public:
70  EQ_API Window( NotifierInterface& parent, const WindowSettings& settings,
71  Pipe& pipe );
72 
74  EQ_API virtual ~Window( );
75 
87  EQ_API virtual void setWGLContext( HGLRC context );
88 
90 
99  EQ_API virtual void setWGLWindowHandle( HWND handle );
100 
110  EQ_API virtual void setWGLPBufferHandle( HPBUFFERARB handle );
111 
113  EQ_API virtual HWND getWGLWindowHandle() const;
114 
116  EQ_API virtual HPBUFFERARB getWGLPBufferHandle() const;
117 
122  EQ_API virtual HDC getWGLDC() const;
123 
125  EQ_API virtual HGLRC getWGLContext() const;
126 
128  EQ_API const EventHandler* getWGLEventHandler() const;
130 
144  EQ_API virtual bool configInit();
145 
147  EQ_API virtual void configExit( );
148 
155  EQ_API virtual bool initWGLAffinityDC();
156 
158  EQ_API virtual void exitWGLAffinityDC();
159 
161  EQ_API virtual HDC getWGLAffinityDC();
162 
172  EQ_API virtual HDC createWGLDisplayDC();
173 
183  EQ_API virtual int chooseWGLPixelFormat();
184 
195  EQ_API virtual bool configInitWGLDrawable( int pixelFormat );
196 
206  EQ_API virtual bool configInitWGLWindow( int pixelFormat );
207 
217  EQ_API virtual bool configInitWGLPBuffer( int pixelFormat );
218 
220  EQ_API virtual bool configInitWGLFBO( int pixelFormat );
221 
230  EQ_API virtual HGLRC createWGLContext();
231 
233  EQ_API virtual void destroyWGLContext( HGLRC context );
234 
239  EQ_API virtual void initEventHandler();
240 
245  EQ_API virtual void exitEventHandler();
247 
251  EQ_API virtual void makeCurrent( const bool cache = true ) const;
252 
254  EQ_API virtual void swapBuffers();
255 
257  EQ_API virtual void joinNVSwapBarrier( const uint32_t group,
258  const uint32_t barrier );
259 
260 
262  void leaveNVSwapBarrier();
263 
265  EQ_API virtual bool processEvent( const WindowEvent& event );
267 
268 protected:
270  EQ_API WGLEWContext* wglewGetContext();
271 
272 private:
273  detail::Window* const _impl;
274 
276  HWND _createWGLWindow( const PixelViewport& pvp );
277 
279  int _chooseWGLPixelFormatARB( HDC pfDC );
280 
282  int _chooseWGLPixelFormat( HDC pfDC );
283 
284  void _initSwapSync();
285 };
286 }
287 }
288 #endif // EQ_WGL_WINDOW_H
289 
virtual EQ_API void setWGLPBufferHandle(HPBUFFERARB handle)
Set the Win32 off screen pbuffer handle for this window.
EQ_API const EventHandler * getWGLEventHandler() const
The interface defining the minimum functionality for a WGL window.
virtual EQ_API HPBUFFERARB getWGLPBufferHandle() const
Equalizer default implementation of a WGL window.
virtual EQ_API HGLRC createWGLContext()
Create a WGL context.
virtual EQ_API HDC createWGLDisplayDC()
Create a device context for the display device of the window.
virtual EQ_API HGLRC getWGLContext() const
virtual EQ_API bool configInitWGLFBO(int pixelFormat)
Initialize the window for an off-screen FBO.
virtual EQ_API void joinNVSwapBarrier(const uint32_t group, const uint32_t barrier)
Join the WGL_NV_swap_group.
virtual ~WindowIF()
Destruct the WGL window.
virtual EQ_API HPBUFFERARB getWGLPBufferHandle() const =0
virtual EQ_API void setWGLContext(HGLRC context)
Set the WGL rendering context for this window.
A set of settings to setup an eq::SystemWindow.
virtual EQ_API bool configInit()
Initialize this window for the WGL window system.
Equalizer default implementation of a WGL GPU.
virtual EQ_API HGLRC getWGLContext() const =0
virtual EQ_API void initEventHandler()
Set up an WGLEventHandler, called by setWGLWindowHandle().
void leaveNVSwapBarrier()
Unbind a WGL_NV_swap_barrier.
The event handler for WGL.
virtual EQ_API void exitEventHandler()
Destroy the WGLEventHandler, called by setWGLWindowHandle().
WindowIF(NotifierInterface &parent, const WindowSettings &settings)
Construct a new WGL window for the given eq::Window.
virtual EQ_API HDC getWGLAffinityDC()
A system window for OpenGL rendering.
Definition: glWindow.h:36
EQ_API Window(NotifierInterface &parent, const WindowSettings &settings, Pipe &pipe)
Create a new WGL window for the given eq::Window.
A base class for notifying errors and events.
virtual EQ_API HWND getWGLWindowHandle() const
virtual EQ_API bool processEvent(const WindowEvent &event)=0
Process the given event.
virtual EQ_API bool initWGLAffinityDC()
Create, if needed, an affinity device context for this window.
virtual EQ_API ~Window()
Destruct the WGL window.
virtual EQ_API int chooseWGLPixelFormat()
Choose a pixel format based on the window's attributes.
virtual EQ_API void destroyWGLContext(HGLRC context)
Destroy the given WGL context.
virtual EQ_API void exitWGLAffinityDC()
Destroy the affinity device context.
virtual EQ_API bool configInitWGLPBuffer(int pixelFormat)
Initialize the window with an off-screen WGL PBuffer.
virtual EQ_API void makeCurrent(const bool cache=true) const
virtual HDC getWGLAffinityDC()
virtual EQ_API void setWGLWindowHandle(HWND handle)
Set the Win32 window handle for this window.
virtual EQ_API void configExit()
A window-system event for a WindowIF.
virtual EQ_API HWND getWGLWindowHandle() const =0
virtual EQ_API bool processEvent(const WindowEvent &event)
virtual EQ_API bool configInitWGLWindow(int pixelFormat)
Initialize the window with an on-screen Win32 window.
virtual EQ_API HDC getWGLDC() const =0
virtual EQ_API bool configInitWGLDrawable(int pixelFormat)
Initialize the window's drawable (pbuffer or window) and bind the WGL context.
virtual EQ_API HDC getWGLDC() const
Includes OpenGL and GLEW headers.
virtual EQ_API void swapBuffers()
EQ_API WGLEWContext * wglewGetContext()