framebuffer.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00033 #ifndef __framebuffer__header__
00034 #define __framebuffer__header__
00035 
00036 #include "gpucalc/bindable.h"
00037 #include "gpucalc/graphic_core.h"
00038 
00039 namespace gpucalc
00040 {
00041 
00050  class _GpuCalcExport FrameBuffer: public Bindable
00051  {
00052 
00053   OBJ_DISABLE_COPY(FrameBuffer)
00054   
00055   
00056   public:
00057    FrameBuffer(const std::string & FrameBufferClassName, const std::string & FrameBufferName, GraphicCore * graphiccore):
00058     Object(FrameBufferClassName, FrameBufferName), Bindable(FrameBufferClassName, FrameBufferName), mDefaultGraphicCore(graphiccore)
00059    {
00060    }
00061 
00062 
00063    virtual ~FrameBuffer()
00064    {
00065    }
00066 
00067 
00068    virtual void initialize() = 0;
00069 
00070 
00076    virtual void attach(const Texture * texture) = 0;
00077 
00078 
00084    virtual void detach(const Texture * texture) = 0;
00085 
00086 
00092    virtual void drawBuffer(const Texture * RenderTarget) = 0;
00093 
00094 
00104    virtual void getData(Data & to, const Texture * from) = 0;
00105 
00106 
00107    void bind()
00108    {
00109     mDefaultGraphicCore->bind(this);
00110    }
00111 
00112 
00113    void unbind()
00114    {
00115     mDefaultGraphicCore->unbind(this);
00116    }
00117 
00118 
00119    bool isActive() const
00120    {
00121     return (this == mDefaultGraphicCore->getActiveFrameBuffer());
00122    }
00123 
00124   protected:
00125    GraphicCore * mDefaultGraphicCore;
00126  };
00127 }
00128 
00129 #endif