Question

i want use a specific customized algorithm to generate mipmaps for some renderable textures (R16F & RGBA16F).

All needed textures' mipmaps are pre-enabled by using glGenerateMipmapEXT().

The biggest problem so far is to render into 1+ mipmap levels. More precisely, this works like a charm:

...
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, target, texType, texId, 0 );
checkFBOStatus();
...
render();

But this gives me a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT when checking fbo status

...
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, target, texType, texId, 1 );
checkFBOStatus();
...
render();

All the difference in code is the lod level parameter for attaching a texture onto the FBO.

after lots of feverish head-scratching, i still cant get it work. So, any answer is greatly appreciated.

[NOTE: target platform is OpenGL 2.x with FBO extension]

Was it helpful?

Solution

Problem SOLVED


The reason of FBO incomplete is due to texture consistence. When using glGenerateMipmapEXT/glGenerateMipmap, u must make sure your texture's base level contains VALID DATA; otherwise, that call fails without any error notification.

There're two possible solutions for your referrence:

  1. Use TexImage or TexSubImage to fillup your renderable texture before glGenerateMipmap

  2. Attach the renderable texture to a dummy FBO before glGenerateMipmap

Either way works (tested on GF8,GF9) Not tested on ATI cards.

That'd be great if anyone can test it out on ATI GPUs.

PS. Pls let me know if u have problem using these solutions.

OTHER TIPS

Wow, I'm having the same problem on ATI Radeon 9800. But I made a call with gltexImage2D.

Render to the first level is possible but not the others. Maybe I should try the dummy FBO method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top