kick
/Users/morten/Programmering/cpp/kick/src/kick/texture/texture_render_target.h
00001 //
00002 // Created by morten on 05/06/14.
00003 //
00004 
00005 
00006 #include "kick/texture/texture2d.h"
00007 #include "kick/core/project.h"
00008 #include "glm/glm.hpp"
00009 #include <vector>
00010 
00011 #pragma once
00012 
00013 namespace kick {
00014     class Texture2D;
00015 
00016     class TextureRenderTarget : public ProjectAsset {
00017     public:
00018         TextureRenderTarget();
00019         ~TextureRenderTarget();
00020         void bind();
00021         void unbind();
00022         glm::ivec2 size() const;
00023         void setSize(glm::ivec2 size);
00024         void setColorTexture(size_t channel, std::shared_ptr<Texture2D> texture);
00025         void setDepthTexture(std::shared_ptr<Texture2D> texture);
00026         std::shared_ptr<Texture2D> colorTexture(size_t channel);
00027         bool deleteColorTexture(size_t channel);
00028         bool deleteDepthTexture();
00029         void apply();
00030     private:
00031         GLuint mFramebuffer = 0;
00032         glm::ivec2 mSize = glm::ivec2{512,512};
00033         std::vector<std::shared_ptr<Texture2D>> mColorTextures;
00034         std::shared_ptr<Texture2D> mDepthTexture;
00035         std::vector<GLuint> mRenderBuffers;
00036         void checkStatus();
00037     };
00038 
00039 }
00040 
00041 
 All Classes Functions Variables