#include "Texture3D.h" Texture3D::Texture3D() : texture(0) { glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_3D, texture); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_MIRRORED_REPEAT); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT); } Texture3D::~Texture3D() { glDeleteTextures(1, &texture); } void Texture3D::setData(int width, int height, int depth, void* data) { glBindTexture(GL_TEXTURE_3D, texture); glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, width, height, depth, 0, GL_RGB, GL_FLOAT, data); } void Texture3D::bindTo(int unit) const { glActiveTexture(GL_TEXTURE0 + unit); glBindTexture(GL_TEXTURE_3D, texture); }