framebuffer.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Kutumov Alexey                                  *
00003  *   ru.pixel@gmail.com                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
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

Generated on Thu Mar 5 22:36:42 2009 for gpucalc by  doxygen 1.5.6