Beispiel #1
0
void LoadGlImage(GlTexture& tex, const std::string& filename, bool sampling_linear)
{
    const GLenum chtypes[] = {
        GL_ALPHA, GL_LUMINANCE_ALPHA,
        GL_RGB, GL_RGBA
    };
    TypedImage img = LoadImage(filename);
    const GLint format  = chtypes[img.fmt.channels];
    const GLint imgtype = GL_UNSIGNED_BYTE;
    tex.Reinitialise(img.w, img.h, format, sampling_linear, 0, format, imgtype, img.ptr );
    img.Dealloc();
}