Add texture module

This commit is contained in:
Mario Hüttel 2020-03-21 19:59:30 +01:00
parent b50cb62ac3
commit b22be7d6a5
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#ifndef OPENGLTEXTURE_HPP
#define OPENGLTEXTURE_HPP
#include <epoxy/gl.h>
class OpenGlTexture
{
public:
OpenGlTexture();
OpenGlTexture(const OpenGlTexture &tex);
OpenGlTexture(const OpenGlTexture &&tex);
~OpenGlTexture();
protected:
GLuint texture;
};
#endif // OPENGLTEXTURE_HPP

28
src/opengltexture.cpp Normal file
View File

@ -0,0 +1,28 @@
#include <opengl-playground/opengltexture.hpp>
OpenGlTexture::OpenGlTexture()
{
glGenTextures(1, &this->texture);
glBindTexture(GL_TEXTURE_2D, this->texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
OpenGlTexture::OpenGlTexture(const OpenGlTexture &tex)
{
this->texture = tex.texture;
}
OpenGlTexture::OpenGlTexture(const OpenGlTexture &&tex)
{
this->texture = tex.texture;
}
OpenGlTexture::~OpenGlTexture()
{
}