Equalizer  1.10.1
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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/glWindow.h> // base class
23 #include <eq/gl.h> // for HPBUFFERARB from wglew.h
24 #include <eq/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 doneCurrent() const;
255 
257  EQ_API virtual void swapBuffers();
258 
260  EQ_API virtual void joinNVSwapBarrier( const uint32_t group,
261  const uint32_t barrier );
262 
263 
265  void leaveNVSwapBarrier();
266 
268  EQ_API virtual bool processEvent( const WindowEvent& event );
270 
271 protected:
273  EQ_API WGLEWContext* wglewGetContext();
274 
275 private:
276  detail::Window* const _impl;
277 
279  HWND _createWGLWindow( const PixelViewport& pvp );
280 
282  int _chooseWGLPixelFormatARB( HDC pfDC );
283 
285  int _chooseWGLPixelFormat( HDC pfDC );
286 
287  void _initSwapSync();
288 };
289 }
290 }
291 #endif // EQ_WGL_WINDOW_H
292 
virtual EQ_API void setWGLPBufferHandle(HPBUFFERARB handle)
Set the Win32 off screen pbuffer handle for this window.
EQ_API const EventHandler * getWGLEventHandler() const
virtual EQ_API void doneCurrent() const
The interface defining the minimum functionality for a WGL window.
Definition: wgl/window.h:33
virtual EQ_API HPBUFFERARB getWGLPBufferHandle() const
Equalizer default implementation of a WGL window.
Definition: wgl/window.h:66
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.
Definition: wgl/window.h:41
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.
Definition: wgl/pipe.h:32
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.
Definition: wgl/window.h:37
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()
Definition: wgl/window.h:59
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()