00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024 #ifndef WGLPBUFFERCONTEXT_HPP
00025 #define WGLPBUFFERCONTEXT_HPP
00026
00027 #include "ShStream.hpp"
00028 #include "ShProgram.hpp"
00029 #include "PBufferContext.hpp"
00030
00031 namespace shgl {
00032
00033 class WGLPBufferHandle : public PBufferHandle {
00034 public:
00035 WGLPBufferHandle(HDC drawable,
00036 HGLRC context);
00037
00038 virtual ~WGLPBufferHandle();
00039
00040 virtual void restore();
00041
00042 private:
00043 HDC m_dc;
00044 HGLRC m_hglrc;
00045 };
00046
00047 class WGLPBufferContext : public PBufferContext {
00048 public:
00049 WGLPBufferContext(int width, int height,
00050 void* id,
00051 HPBUFFERARB pbuffer,
00052 HDC dc, HGLRC hglrc);
00053
00054 virtual ~WGLPBufferContext();
00055
00056 virtual PBufferHandlePtr activate();
00057
00058 private:
00059 HPBUFFERARB m_pbuffer;
00060 HDC m_dc;
00061 HGLRC m_hglrc;
00062 };
00063
00064 typedef SH::ShPointer<WGLPBufferContext> WGLPBufferContextPtr;
00065 typedef SH::ShPointer<const WGLPBufferContext> WGLPBufferContextCPtr;
00066
00067 class WGLPBufferFactory : public PBufferFactory {
00068 public:
00069 static WGLPBufferFactory* instance();
00070
00071 PBufferContextPtr get_context(int width, int height, void* id);
00072 FloatExtension get_extension();
00073
00074 protected:
00075 WGLPBufferFactory();
00076 virtual ~WGLPBufferFactory();
00077
00078 private:
00079 WGLPBufferContextPtr create_context(int width, int height, void* id);
00080
00081 void init_dc();
00082 void init_config();
00083
00084 HDC m_dc;
00085 int m_format;
00086 FloatExtension m_extension;
00087
00088 std::list<WGLPBufferContextPtr> m_contexts;
00089
00090 static WGLPBufferFactory* m_instance;
00091 };
00092
00093 }
00094
00095 #endif