Equalizer 1.0

wglWindow.h

00001 /* Copyright (c) 2005-2011, Stefan Eilemann <eile@equalizergraphics.com>
00002  *                    2009, Maxim Makhinya
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef EQ_OS_WINDOW_WGL_H
00019 #define EQ_OS_WINDOW_WGL_H
00020 
00021 #include <eq/glWindow.h>       // base class
00022 
00023 namespace eq
00024 {
00025     class WGLEventHandler;
00026     class WGLPipe;
00027     class WGLWindowEvent;
00028 
00030     class WGLWindowIF : public GLWindow
00031     {
00032     public:
00034         WGLWindowIF( Window* parent ) : GLWindow( parent ) {}
00035 
00037         virtual ~WGLWindowIF() {}
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 WGLWindowEvent& event ) = 0;
00059 
00060     private:
00061         struct Private;
00062         Private* _private; // placeholder for binary-compatible changes
00063     };
00064 
00066     class WGLWindow : public WGLWindowIF
00067     {
00068     public:
00070         EQ_API WGLWindow( Window* parent );
00071 
00073         EQ_API virtual ~WGLWindow( );
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 WGLEventHandler* 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 WGLWindowEvent& 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         WGLPipe* 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         WGLEventHandler* _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_OS_WINDOW_WGL_H
00325 
Generated on Sun May 8 2011 19:11:08 for Equalizer 1.0 by  doxygen 1.7.3