How to create a mipmapped texture from the frame buffer

Started by
6 comments, last by Brother Bob 16 years, 6 months ago
Hello, Could anyone give me some ideas about how to create a mipmapped texture from the frame buffer? glCopyTexSubImage2D has a parameter that specifies the mipmap level, but how do I know how many levels the texture should have and how to copy the levels other than the base level (level 0)? Thank you in advance! Kenny
Advertisement
Either use the SGIS_GENERATE_MIPMAPS extension which will generate the mipmaps automatically once you copy the texture with glCopyTexSubImage2D or use glGenerateMipmapsEXT from the FBO extension to do this explicitly.
use standard GL_GENERATE_MIPMAP for glTexParameter
Thank you all for the replies. What should I do to enable the extensions? It seems Microsoft's OpenGL implementation does not support them by default...
If you're using Microsoft implementation, which is software, concider using Mesa instead. It also a software implementation, but at least it's up to date and it's quite good also. Or, check your graphics device manufacturer's site for drivers for your graphics card which hopefully will provide a proper implementation of OpenGL for your hardware.
just install gpu driver, dowload glext.h from http://oss.sgi.com/projects/ogl-sample/sdk.html (or just go with GLEW- http://glew.sourceforge.net/) and you are ready to go
Thanks for all the replies! I tried the SGIS_GENERATE_MIPMAPS extension, and it works quite well.

But for some considerations, I would rather not use any of the extentions. Since glCopyTexSubImage2D has a parameter that specifies the mipmap level, I believe we are able to write to a certain level of mipmaps of the texture. Does anyone has the experience to copy the frame buffer to a non-base level of the mipmap?
Just specify the mipmap level you want to update in the level parameter. Just keep in mind that you need to render the image smaller and smaller for each mipmap level you want to update.

And by the way, automatic mipmap generation is a part of the core API since OpenGL 1.4, so no need for extensions anyway to use it.

This topic is closed to new replies.

Advertisement