7 : image_data_handle(0), texture_handle(0), texture_type(
VIS2_TEX_TYPE_RGB), texture_width(0), texture_height(0)
12 glActiveTexture(GL_TEXTURE0);
21 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, ilGetInteger(IL_IMAGE_WIDTH),ilGetInteger(IL_IMAGE_HEIGHT), 0, GL_RGB, GL_UNSIGNED_BYTE,ilGetData());
24 glGenerateMipmap(GL_TEXTURE_2D);
25 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
26 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
30 Texture::Texture(
const unsigned int _width,
const unsigned int _height,
const unsigned int _type)
31 : image_data_handle(0), texture_handle(0), texture_type(
VIS2_TEX_TYPE_RGB), texture_width(_width), texture_height(_height)
43 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, _width, _height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
49 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, _width, _height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
56 glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, _width, _height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
65 glGenerateMipmap(GL_TEXTURE_2D);
66 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
67 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
68 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
69 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
83 glActiveTexture(GL_TEXTURE0 + _unit);
93 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + _unit, GL_TEXTURE_2D, this->
texture_handle, 0);
96 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + _unit, GL_TEXTURE_2D, this->
texture_handle, 0);
99 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, this->
texture_handle, 0);
113 std::cout <<
"Loading texture from file \"" << _file_path <<
"\" ." << std::endl;
114 if (ilLoadImage((
const ILstring)_file_path.c_str()) != IL_TRUE){
115 std::cout <<
"Failed to load texture file \"" << _file_path <<
"\" !" << std::endl;