00001
00002
00003
00004
00005 #ifndef EQ_OS_WINDOW_AGL_H
00006 #define EQ_OS_WINDOW_AGL_H
00007
00008 #include <eq/client/osWindow.h>
00009 #include <eq/client/aglWindowEvent.h>
00010
00011 namespace eq
00012 {
00014 class EQ_EXPORT AGLWindowIF : public OSWindow
00015 {
00016 public:
00017 AGLWindowIF( Window* parent ) : OSWindow( parent ), _carbonHandler( 0 )
00018 {}
00019 virtual ~AGLWindowIF() {}
00020
00022 virtual AGLContext getAGLContext() const = 0;
00023
00025 virtual WindowRef getCarbonWindow() const = 0;
00026
00028 virtual AGLPbuffer getAGLPBuffer() const = 0;
00029
00031 virtual bool processEvent( const AGLWindowEvent& event )
00032 { return _window->processEvent( event ); }
00033
00035 EventHandlerRef& getCarbonEventHandler() { return _carbonHandler; }
00036
00037 private:
00039 EventHandlerRef _carbonHandler;
00040 };
00041
00043 class EQ_EXPORT AGLWindow : public AGLWindowIF
00044 {
00045 public:
00046 AGLWindow( Window* parent );
00047 virtual ~AGLWindow( );
00048
00049 virtual void configExit( );
00050 virtual void makeCurrent() const;
00051 virtual void swapBuffers();
00052
00053 virtual base::SpinLock* getContextLock() { return &_renderContextLock; }
00054
00056 virtual AGLContext getAGLContext() const { return _aglContext; }
00057
00059 virtual WindowRef getCarbonWindow() const { return _carbonWindow; }
00060
00062 virtual AGLPbuffer getAGLPBuffer() const { return _aglPBuffer; }
00063
00065
00075 virtual void setAGLContext( AGLContext context );
00076
00082 virtual void setCarbonWindow( WindowRef window );
00083
00089 virtual void setAGLPBuffer( AGLPbuffer pbuffer );
00090
00091
00092
00093
00104 virtual bool configInit();
00105
00117 virtual AGLPixelFormat chooseAGLPixelFormat();
00118
00127 virtual void destroyAGLPixelFormat( AGLPixelFormat pixelFormat );
00128
00140 virtual AGLContext createAGLContext( AGLPixelFormat pixelFormat );
00141
00151 virtual bool configInitAGLDrawable();
00152
00163 virtual bool configInitAGLFullscreen();
00164
00175 virtual bool configInitAGLWindow();
00176
00184 virtual bool configInitAGLPBuffer();
00185
00186 virtual void initEventHandler();
00187 virtual void exitEventHandler();
00188
00189
00190 virtual bool processEvent( const AGLWindowEvent& event );
00191
00192 private:
00194 AGLContext _aglContext;
00196 WindowRef _carbonWindow;
00198 AGLPbuffer _aglPBuffer;
00199
00200 base::SpinLock _renderContextLock;
00201 };
00202 }
00203
00204 #endif // EQ_OS_WINDOW_AGL_H
00205