Jump to content
  • Advertisement
Sign in to follow this  
iamkenny

How to create a mipmapped texture from the frame buffer

This topic is 4064 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!