hi there,
how do you do mipmapping with texture storage?
I tried the following on AMD Catalyst 14.7 rc3, but it didn't really seem to work.
//create immutable texture storage
glGenTextures( 1, &orig_tex );
float num_mips = std::log2( float( std::max( orig_tex_width, orig_tex_height ) ) ) + 1;
glBindTexture( GL_TEXTURE_2D, orig_tex );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 4);
//mipmapping doesn't work
glTexStorage2D( GL_TEXTURE_2D, num_mips, GL_RGBA8, orig_tex_width, orig_tex_height );
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, im.getSize().x, im.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, im.getPixelsPtr() );
//mipmapping works, but this is not immutable storage
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, orig_tex_width, orig_tex_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixel_data );
glGenerateMipmap( GL_TEXTURE_2D );
/**
.
.
.
/**/
//create texture views for the immutable storage
glGenTextures( 1, &tex );
glTextureView( tex, GL_TEXTURE_2D, orig_tex, GL_RGBA8, 0, num_mips, 0, 1 );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 4);
//"texture view" workaround, as texstorage doesn't work
tex = orig_tex; //...
Best regards,
Yours3!f