I'm trying to sample a certain mipmap level of a mipmapped texture. How do I do that?
//do the downsampling
tex.bind();
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glGenerateMipmap( GL_TEXTURE_2D );
//process the half res texture
glViewport( 0, 0, o->conf.SCREEN_WIDTH / 2, o->conf.SCREEN_HEIGHT / 2 );
half_fbo.bind();
shader->bind();
shader->pass_m4x4( o->ppl.get_projection_matrix(), "proj" );
shader->pass_m4x4( o->ppl.get_model_view_matrix(), "modelview" );
shader->pass_int( 0, "texture0" );
tex.bind();
//how do I select the desired mipmap level here?
quad.render();
shader->unbind();
half_fbo.unbind();
Best regards,
Yours3!f