This repository has been archived on 2022-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
space-war/include/tinyengine/texture.hpp

28 lines
610 B
C++

#pragma once
#include "pch.hpp"
#include "libmath.hpp"
#include "glhelpfunc.hpp"
#include "tool.hpp"
class Texture {
public:
Texture(const std::string& filename);
Texture(const unsigned char* data, int w, int h, GLenum format);
Texture(const Texture&) = delete;
Texture& operator=(const Texture&) = delete;
~Texture();
void Bind(GLuint slot = 0) const;
void Unbind() const;
const Size& GetSize() const { return size_; }
private:
GLuint texture_;
GLenum format_;
Size size_;
void createFromPixels(const unsigned char* data, int w, int h, GLenum format);
};