#include "Shader.h" #include "imgui/stb_image.h" Texture::Texture(std::string file_name) { int width, height, channel; unsigned char * image; glActiveTexture(GL_TEXTURE0); glGenTextures(1, &tex_ref); glBindTexture(GL_TEXTURE_2D, tex_ref); image = stbi_load(file_name.c_str(), &width, &height, &channel, 0); GLuint enum_rgb = GL_RGB + (channel == 4); glTexImage2D(GL_TEXTURE_2D, 0, enum_rgb, width, height, 0, enum_rgb, GL_UNSIGNED_BYTE, image); glGenerateMipmap(GL_TEXTURE_2D); stbi_image_free(image); glBindTexture(GL_TEXTURE_2D, 0); } Texture::Texture(const Texture &other) { tex_ref = other.tex_ref; } Texture::~Texture() { }