Hello everyone,
I am having problem with customizing mipmap generation with integer format texture.
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA32UI_EXT, 512, 512, 0, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_INT, NULL);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST );
I can customize mipmap generation with floating-point texture.
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
Here is the sample code from EXT_framebuffer_object document (Example #5)
The base level, step 1, is always rendered correctly. Instead of step 2, glGenerateMipmapEXT() is used.
Then at step 3 the whole texture levels can be viewed. It works but the content of each level is the same.
It seems that glGenerateMipmapEXT does nothing except copying data from base level to the others in case of integer format texture.
If I enable step 2 to manually draw each level then the texture becomes blank even the base level.
Does anybody know this problem?
Any help is highly appreciated,
Thanks
I am having problem with customizing mipmap generation with integer format texture.
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA32UI_EXT, 512, 512, 0, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_INT, NULL);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST );
I can customize mipmap generation with floating-point texture.
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
Here is the sample code from EXT_framebuffer_object document (Example #5)
Code:
glBindTexture(GL_TEXTURE_2D, 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, color_tex, 0);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_rb);
<1. draw to the base level of the color texture>
// custom-generate successive mipmap levels
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0);
glBindTexture(GL_TEXTURE_2D, color_tex);
foreach (level > 0, in order of increasing values of level)
{
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, color_tex, level);
glTexParameteri(TEXTURE_2D, TEXTURE_BASE_LEVEL, level-1);
glTexParameteri(TEXTURE_2D, TEXTURE_MAX_LEVEL, level-1);
<2. draw to level>
}
glTexParameteri(TEXTURE_2D, TEXTURE_BASE_LEVEL, 0);
glTexParameteri(TEXTURE_2D, TEXTURE_MAX_LEVEL, max);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
<3. draw to the window, reading from the color texture>
The base level, step 1, is always rendered correctly. Instead of step 2, glGenerateMipmapEXT() is used.
Then at step 3 the whole texture levels can be viewed. It works but the content of each level is the same.
It seems that glGenerateMipmapEXT does nothing except copying data from base level to the others in case of integer format texture.
If I enable step 2 to manually draw each level then the texture becomes blank even the base level.
Does anybody know this problem?
Any help is highly appreciated,
Thanks