wglWindow.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef EQ_OS_WINDOW_WGL_H
00019 #define EQ_OS_WINDOW_WGL_H
00020
00021 #include <eq/client/osWindow.h>
00022 #include <eq/client/wglWindowEvent.h>
00023
00024 namespace eq
00025 {
00026 class WGLEventHandler;
00027
00029 class EQ_EXPORT WGLWindowIF : public OSWindow
00030 {
00031 public:
00032 WGLWindowIF( Window* parent ) : OSWindow( parent ) {}
00033 virtual ~WGLWindowIF() {}
00034
00036 virtual HGLRC getWGLContext() const = 0;
00037
00039 virtual HWND getWGLWindowHandle() const = 0;
00040
00042 virtual HPBUFFERARB getWGLPBufferHandle() const = 0;
00043
00045 virtual HDC getWGLDC() const = 0;
00046
00048 virtual HDC getWGLAffinityDC() { return 0; }
00049
00050 virtual bool processEvent( const WGLWindowEvent& event )
00051 { return _window->processEvent( event ); }
00052 };
00053
00055 class EQ_EXPORT WGLWindow : public WGLWindowIF
00056 {
00057 public:
00058 WGLWindow( Window* parent );
00059 virtual ~WGLWindow( );
00060
00061 virtual void configExit( );
00062 virtual void makeCurrent() const;
00063 virtual void swapBuffers();
00064 virtual void joinNVSwapBarrier( const uint32_t group,
00065 const uint32_t barrier );
00066
00068 virtual HWND getWGLWindowHandle() const { return _wglWindow; }
00069
00071 virtual HPBUFFERARB getWGLPBufferHandle() const { return _wglPBuffer; }
00072
00074 virtual HDC getWGLDC() const { return _wglDC; }
00075
00077 virtual HGLRC getWGLContext() const { return _wglContext; }
00078
00080 const WGLEventHandler* getWGLEventHandler() const
00081 { return _wglEventHandler; }
00082
00093 virtual void setWGLWindowHandle( HWND handle );
00094
00103 virtual void setWGLPBufferHandle( HPBUFFERARB handle );
00104
00114 virtual void setWGLContext( HGLRC context );
00116
00129 virtual bool configInit();
00130
00136 virtual bool initWGLAffinityDC();
00137
00139 virtual void exitWGLAffinityDC();
00140
00142 virtual HDC getWGLAffinityDC();
00143
00152 virtual HDC createWGLDisplayDC();
00153
00162 virtual int chooseWGLPixelFormat();
00163
00173 virtual bool configInitWGLDrawable( int pixelFormat );
00174
00183 virtual bool configInitWGLWindow( int pixelFormat );
00184
00193 virtual bool configInitWGLPBuffer( int pixelFormat );
00194
00196 virtual bool configInitWGLFBO( int pixelFormat );
00197
00205 virtual HGLRC createWGLContext();
00206
00207 virtual void initEventHandler();
00208 virtual void exitEventHandler();
00209 virtual bool processEvent( const WGLWindowEvent& event );
00211
00212 protected:
00214 enum WGLDCType
00215 {
00216 WGL_DC_NONE,
00217 WGL_DC_WINDOW,
00218 WGL_DC_PBUFFER,
00219 WGL_DC_AFFINITY,
00220 WGL_DC_DISPLAY
00221 };
00222
00229 void setWGLDC( HDC dc, const WGLDCType type );
00230
00232 void leaveNVSwapBarrier();
00233
00234 private:
00235
00236 HWND _wglWindow;
00237 HPBUFFERARB _wglPBuffer;
00238 HGLRC _wglContext;
00239
00240 HDC _wglDC;
00241 WGLDCType _wglDCType;
00242 HDC _wglAffinityDC;
00243
00244 WGLEventHandler* _wglEventHandler;
00245 BOOL _screenSaverActive;
00246
00247 uint32_t _wglNVSwapGroup;
00248
00249 union
00250 {
00251 char dummy[64];
00252 };
00253
00255 HWND _createWGLWindow( int pixelFormat, const PixelViewport& pvp );
00256 };
00257 }
00258
00259 #endif // EQ_OS_WINDOW_WGL_H
00260