Equalizer  1.2.1
include/eq/client/wgl/window.h
00001 
00002 /* Copyright (c) 2005-2011, Stefan Eilemann <eile@equalizergraphics.com>
00003  *                    2009, Maxim Makhinya
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *  
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  * 
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00019 #ifndef EQ_WGL_WINDOW_H
00020 #define EQ_WGL_WINDOW_H
00021 
00022 #include <eq/client/glWindow.h>       // base class
00023 #include <eq/client/wgl/types.h>
00024 
00025 namespace eq
00026 {
00027 namespace wgl
00028 {
00030     class WindowIF : public GLWindow
00031     {
00032     public:
00034         WindowIF( eq::Window* parent ) : GLWindow( parent ) {}
00035 
00037         virtual ~WindowIF() {}
00038 
00040         EQ_API virtual HGLRC getWGLContext() const = 0;
00041 
00043         EQ_API virtual HWND getWGLWindowHandle() const = 0;
00044 
00046         EQ_API virtual HPBUFFERARB getWGLPBufferHandle() const = 0;
00047 
00052         EQ_API virtual HDC getWGLDC() const = 0;
00053 
00055         virtual HDC getWGLAffinityDC() { return 0; }
00056 
00058         EQ_API virtual bool processEvent( const WindowEvent& event ) = 0;
00059 
00060     private:
00061         struct Private;
00062         Private* _private; // placeholder for binary-compatible changes
00063     };
00064 
00066     class Window : public WindowIF
00067     {
00068     public:
00070         EQ_API Window( eq::Window* parent );
00071 
00073         EQ_API virtual ~Window( );
00074 
00086         EQ_API virtual void setWGLContext( HGLRC context );
00087 
00089 
00098         EQ_API virtual void setWGLWindowHandle( HWND handle );
00099         
00109         EQ_API virtual void setWGLPBufferHandle( HPBUFFERARB handle );
00110 
00112         virtual HWND getWGLWindowHandle() const { return _wglWindow; }
00113 
00115         virtual HPBUFFERARB getWGLPBufferHandle() const { return _wglPBuffer; }
00116 
00121         virtual HDC getWGLDC() const { return _wglDC; }
00122 
00124         virtual HGLRC getWGLContext() const { return _wglContext; }
00125 
00127         const EventHandler* getWGLEventHandler() const 
00128             { return _wglEventHandler; }
00130 
00144         EQ_API virtual bool configInit();
00145 
00147         EQ_API virtual void configExit( );
00148 
00155         EQ_API virtual bool initWGLAffinityDC();
00156 
00158         EQ_API virtual void exitWGLAffinityDC();
00159 
00161         EQ_API virtual HDC getWGLAffinityDC();
00162 
00172         EQ_API virtual HDC createWGLDisplayDC();
00173 
00183         EQ_API virtual int chooseWGLPixelFormat();
00184 
00195         EQ_API virtual bool configInitWGLDrawable( int pixelFormat );
00196 
00206         EQ_API virtual bool configInitWGLWindow( int pixelFormat );
00207 
00217         EQ_API virtual bool configInitWGLPBuffer( int pixelFormat );
00218 
00220         EQ_API virtual bool configInitWGLFBO( int pixelFormat );
00221 
00230         EQ_API virtual HGLRC createWGLContext();
00231 
00233         EQ_API virtual void destroyWGLContext( HGLRC context );
00234 
00239         EQ_API virtual void initEventHandler();
00240 
00245         EQ_API virtual void exitEventHandler();
00247 
00251         EQ_API virtual void makeCurrent() const;
00252 
00254         EQ_API virtual void swapBuffers();
00255 
00257         EQ_API virtual void joinNVSwapBarrier( const uint32_t group,
00258                                                const uint32_t barrier );
00259 
00260 
00262         void leaveNVSwapBarrier();
00263 
00265         EQ_API virtual bool processEvent( const WindowEvent& event );
00267 
00268     protected:
00270         enum WGLDCType
00271         {
00272             WGL_DC_NONE,     
00273             WGL_DC_WINDOW,   
00274             WGL_DC_PBUFFER,  
00275             WGL_DC_AFFINITY, 
00276             WGL_DC_DISPLAY   
00277         };
00278 
00285         void setWGLDC( HDC dc, const WGLDCType type );
00286 
00288         EQ_API WGLEWContext* wglewGetContext();
00289 
00291         Pipe* getWGLPipe();
00292 
00293     private:
00294 
00295         HWND             _wglWindow;
00296         HPBUFFERARB      _wglPBuffer;
00297         HGLRC            _wglContext;
00298 
00299         HDC              _wglDC;
00300         WGLDCType        _wglDCType;
00301         HDC              _wglAffinityDC;
00302 
00303         EventHandler* _wglEventHandler;
00304         BOOL          _screenSaverActive;
00305 
00306         uint32_t         _wglNVSwapGroup;
00307 
00308         struct Private;
00309         Private* _private; // placeholder for binary-compatible changes
00310 
00312         HWND _createWGLWindow( int pixelFormat, const PixelViewport& pvp );
00313 
00315         int _chooseWGLPixelFormatARB( HDC pfDC );
00316 
00318         int _chooseWGLPixelFormat( HDC pfDC );
00319 
00320         void _initSwapSync();
00321     };
00322 }
00323 }
00324 #endif // EQ_WGL_WINDOW_H
00325 
Generated on Fri Jun 8 2012 15:44:33 for Equalizer 1.2.1 by  doxygen 1.8.0