add Sampler class, add attributes system

This commit is contained in:
2017-01-21 00:16:36 +00:00
parent eb7282e0d4
commit 21622fd24c
6 changed files with 146 additions and 9 deletions

View File

@@ -7,8 +7,7 @@ class Texture2D
int m_height;
GLint m_format;
public:
bool create(int width, int height, GLint format = GL_RGBA,
const uint8_t* data = nullptr, GLint filter = GL_LINEAR, GLint wrap = GL_CLAMP_TO_EDGE);
bool create(int width, int height, GLint format = GL_RGBA, const uint8_t* data = nullptr);
bool create(const class Image& img);
bool load(std::string filename);
void destroy() { glDeleteTextures(1, &m_tex); }
@@ -16,3 +15,14 @@ public:
void unbind() const { glBindTexture(GL_TEXTURE_2D, 0); }
void update(const uint8_t* data);
};
class Sampler
{
GLuint id;
GLint current_unit;
public:
bool create(GLint filter = GL_LINEAR, GLint wrap = GL_CLAMP_TO_EDGE);
void set(GLint filter = GL_LINEAR, GLint wrap = GL_CLAMP_TO_EDGE);
void bind(int unit);
void unbind();
};