Jump to content
  • Advertisement
Sign in to follow this  
-mainframe-

OpenGL How to generate Mipmaps the most efficient way? (SOLVED)

This topic is 4610 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 everybody, after reading the OpenGL Programming Guide I'm a bit confused because of the many techniques avalable to generate Mipmaps. In fact I want to render something to a texture which should be able to be drawn mipmapped for each Frame, so all the mipmaps have to be generated once per Frame. Thats why i'm searching the most efficient way. Here are the 4 Possibilites I heared about already. It would be great to know which ones of those are taking advantage of Hardware Filtering on current Gaming Hardware OpenGL implementations and probably run fastest: 1. gluBuild*DMapmaps() or gluBuild*DMipmapLevels 2. glTexParameter*([GLenum target], GL_GENERATE_MIPMAP, GL_TRUE) 3. Using the SGIS_generate_mipmap extension 4. Using a render_texture extension. I'm thinking about that last possibility somehow like this: When each Mipmap Level is half as big as the next lower one, rendering a plane with this lower level mipmap on it which fits exactly the used viewport should enable linear graphics hardware texture filters to average the color values of always 4 Texels to store the result in the corresponding Pixel in the processed mipmap. Thx in advance... [Edited by - -mainframe- on January 4, 2006 5:45:09 PM]

Share this post


Link to post
Share on other sites
Advertisement
Does the texture change every frame? The usual way to do it is computing mipmaps once and reusing it every frame.

Share this post


Link to post
Share on other sites
So
glTexParameter*([GLenum target], GL_GENERATE_MIPMAP, GL_TRUE)
is definitely slower than using the SGIS_generate_mipmap extension?
Its just hard to believe that a Core OpenGL function loads the Texture Date back to System Memory, performs the operations with the CPU and is uploading it again to the hardware while there is probably a better way.
Has anybody tested some of those possibilities to generate Mipmaps?

Share this post


Link to post
Share on other sites
Hm? it's the same thing. You use the SGIS_generate_mipmap extension by setting the GENERATE_MIPMAP parameter to TRUE.

Share this post


Link to post
Share on other sites
Thx, sorry for wasting your time.
Watched the extension specs before and just saw that they were written against OpenGL 1.0. No hint about including it into the oGL Core features like in the ARB_multitexture specs.
However, I'll try that, writing one line of Code isn't really loosing time...

Share this post


Link to post
Share on other sites
Quote:
Original post by -mainframe-
In fact I want to render something to a texture which should be able to be drawn mipmapped for each Frame, so all the mipmaps have to be generated once per Frame. Thats why i'm searching the most efficient way.


If you are using or have the FBO extension avaible to you then you should be using any of the ones you listed. You should be using the 'GenerateMipmapEXT' function instead.

Unlike the SGIS extension the mipmap generation occurs then the program asks it to, not as some possible point in the future, which can be hard to work out with render-targets thus the addition of this function.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!