gl_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 __gl_framebuffer__header__
00034 #define __gl_framebuffer__header__
00035
00036 #include "gpucalc/framebuffer.h"
00037 #include <GL/glew.h>
00038
00039 #include "gpucalc/log_manager.h"
00040
00041 namespace gpucalc
00042 {
00105 class GLTexture;
00106 class GLGraphicCore;
00107
00108
00109 const char _GLFrameBufferClassName [] = "GLFrameBuffer";
00110
00111
00112 class _GpuCalcPrivate GLFrameBuffer: public FrameBuffer
00113 {
00114
00115 OBJ_DISABLE_COPY(GLFrameBuffer)
00116
00117
00118 friend class GLGraphicCore;
00119
00120
00121 public:
00122 ~GLFrameBuffer()
00123 {
00124 glDeleteFramebuffersEXT(1, &mGLFrameBufferID);
00125 LogManager::getSingleton().logMessage(this, "FrameBuffer ID deleted for OpenGL memory.", LML_Normal);
00126 }
00127
00128
00129 void initialize();
00130
00131
00135 void attach(const Texture * texture);
00136
00137
00141 void detach(const Texture * texture);
00142
00143
00147 void drawBuffer(const Texture * RenderTarget);
00148
00149
00153 void getData(Data & data, const Texture * from);
00154
00155
00156 void checkErrors(const std::string & where);
00157
00158
00159 private:
00160 GLuint mGLFrameBufferID;
00161
00162
00163 GLint mGLFrameBufferWidth;
00164
00165
00166 GLint mGLFrameBufferHeight;
00167
00168
00169 GLenum mGLFrameBufferFormat;
00170
00171
00172 GLenum mGLFrameBufferType;
00173
00174
00175 GLint mMaxNumberOfAttachment;
00176
00177
00178 typedef std::vector<const Texture *> AttachmentList;
00179
00180
00181 AttachmentList mAttachmentList;
00182
00183
00184 GLFrameBuffer(const std::string & FrameBufferName, GLint MaxNumberOfAttachments, GraphicCore * DefaultGLGraphicCore):
00185 Object(_GLFrameBufferClassName, FrameBufferName), FrameBuffer(_GLFrameBufferClassName, FrameBufferName, DefaultGLGraphicCore),
00186 mGLFrameBufferID(0), mGLFrameBufferWidth(0), mGLFrameBufferHeight(0), mGLFrameBufferFormat(0), mGLFrameBufferType(0),
00187 mMaxNumberOfAttachment(MaxNumberOfAttachments), mAttachmentList(MaxNumberOfAttachments)
00188 {
00189 }
00190
00191
00192 GLint getFirstFreeAttachment() const;
00193
00194
00195 GLint getIndexByTexture(const Texture * texture) const;
00196
00197
00198 GLint getIndexByTextureName(const std::string & TextureName) const;
00199 };
00200 }
00201
00202 #endif