#ifndef __OPENGLPLAYGROUND_TEXTURE_HH__ #define __OPENGLPLAYGROUND_TEXTURE_HH__ #include #include #include #include #include #include "common.hh" class Framebuffer { public: Framebuffer(); ~Framebuffer(); Framebuffer(Framebuffer const& copy) = delete; Framebuffer& operator=(Framebuffer const& copy) = delete; Framebuffer(Framebuffer && move); Framebuffer& operator=(Framebuffer && move); void bind() const; gl::GLuint getID() const { return _fbID; } void attachTexture(GLenum textarget, gl::GLuint texID); private: gl::GLuint _fbID; }; class TextureCubeMap { public: TextureCubeMap(unsigned size); ~TextureCubeMap(); TextureCubeMap(TextureCubeMap const& copy) = delete; TextureCubeMap& operator=(TextureCubeMap const& copy) = delete; TextureCubeMap(TextureCubeMap && move); TextureCubeMap& operator=(TextureCubeMap && move); void bind() const; gl::GLuint getID() const { return _texID; } private: gl::GLuint _texID; }; class Texture2D { public: Texture2D(unsigned width, unsigned height, bool alpha = false); Texture2D(std::string const& file); Texture2D(SDL_Surface *surface); Texture2D(Texture2D const& copy) = delete; Texture2D& operator=(Texture2D const& copy) = delete; Texture2D(Texture2D&& move); Texture2D& operator=(Texture2D&& move); ~Texture2D(); void bind() const; void copyFromSurface(SDL_Surface *src); SDL_Surface* copyToSurface(); private: void _glCreate(unsigned width, unsigned height, bool alpha = false); gl::GLuint texID_; unsigned width_, height_; bool alpha_; }; #endif