19 GLint int_format = GL_RGBA;
20 GLsizei w(image->width()), h(image->height()), c(image->channels());
24 void* data = (
void*)
const_cast<uint8_t*
>(image->get_data_pointer());
25 GLint type = GL_UNSIGNED_BYTE;
26 GLint format = GL_RGBA;
29 case 1: format = GL_RED;
break;
30 case 2: format = GL_RG;
break;
31 case 3: format = GL_RGB;
break;
32 case 4: format = GL_RGBA;
break;
34 throw std::invalid_argument(
"Invalid amount of image channels");
38 std::cout <<
"Level: " << level <<
", internal format: " << int_format
39 <<
", size: " << w <<
"x" << h <<
", format: " << format
44 glTexImage2D(GL_TEXTURE_2D, level, int_format, w, h,
45 border, format, type, data);
46 glGenerateMipmap(GL_TEXTURE_2D);