4 #include "opengl/texture-gl.h"
15 TextureGL::~TextureGL()
17 glDeleteTextures(1, &tex);
20 void TextureGL::update()
23 glGenTextures(1, &tex);
24 glBindTexture(GL_TEXTURE_2D, tex);
25 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
26 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
29 glBindTexture(GL_TEXTURE_2D, tex);
32 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
33 glGenerateMipmap(GL_TEXTURE_2D);
37 void TextureGL::bind()
39 glBindTexture(GL_TEXTURE_2D, tex);