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