Add texture module
This commit is contained in:
parent
b50cb62ac3
commit
b22be7d6a5
19
include/opengl-playground/opengltexture.hpp
Normal file
19
include/opengl-playground/opengltexture.hpp
Normal 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
28
src/opengltexture.cpp
Normal 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()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user