Jump to content
  • Advertisement
Sign in to follow this  
necrophilissimo

OpenGL Reducing texture resolution "on the run"

This topic is 4405 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

I was wondering does OpenGL have any trick to reduce size of a loaded texture "on-the-run"? What I'm trying to do is blur effect with low-end hardware; Capture the screen to texture, reduce texture size to half, and then render it in original size with mipmapping. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
You can always use some sort of image manipulation library to get the image size in half. Problem I always had with downscaling a image is making it look good since what do you sample when u are reducing the image size.

Share this post


Link to post
Share on other sites
Do you have the SGIS_generate_mipmap extension? Depending on how you render to texture it's possible to enable fast automatic hardware mipmap generation. Just use LOD 1 and blur it (it will be half the width/height).

Share this post


Link to post
Share on other sites
You might not have to scale the image down, I'm doing blurring by translating and blending the texture again. You can repeat the translate/blending operation as often as you want.

If you still want to scale your image and your hardware doesn't support automated mimapping, take a look at gluScaleImage.

Cheers,
Shadx

Share this post


Link to post
Share on other sites
Quote:
Original post by deavik
Do you have the SGIS_generate_mipmap extension? Depending on how you render to texture it's possible to enable fast automatic hardware mipmap generation. Just use LOD 1 and blur it (it will be half the width/height).


I found that generate_mipmap was very slow, regardless of how good the hardware was.

necrophilissimo: You can do a good blur by rendering the texture multiple times to the framebuffer and copying the result into a final texture. As an optimisation this rendering can be done at half or a quater of the original texture size, and gives good quality results if you set your blend weights up well.

Share this post


Link to post
Share on other sites
Quote:
Original post by OrangyTang
Quote:
Original post by deavik
Do you have the SGIS_generate_mipmap extension? Depending on how you render to texture it's possible to enable fast automatic hardware mipmap generation. Just use LOD 1 and blur it (it will be half the width/height).


I found that generate_mipmap was very slow, regardless of how good the hardware was.

necrophilissimo: You can do a good blur by rendering the texture multiple times to the framebuffer and copying the result into a final texture. As an optimisation this rendering can be done at half or a quater of the original texture size, and gives good quality results if you set your blend weights up well.


As a sidenote to this, if you have the FBO extension present then you shouldn't really use this, instead you should use it's supplied glGenerateMipMapsARB() function (might want to check that function name) to do it at a time when it's usefull for you, the automatic mipmap generation extension doesn't garentee when it will happen, just that it will.

Share this post


Link to post
Share on other sites
Quote:
Original post by phantom
As a sidenote to this, if you have the FBO extension present then you shouldn't really use this, instead you should use it's supplied glGenerateMipMapsARB() function (might want to check that function name) to do it at a time when it's usefull for you, the automatic mipmap generation extension doesn't garentee when it will happen, just that it will.

Is that much different from the old GL_GENERATE_MIPMAP_SGIS extension though? When I last tried it the SGIS version was very slow, and the quality was poor (just a regular box filter, you can get much better results using the above method).

Although obviously if FBOs are available you'd be using them instead of doing copies from the framebuffer.

Share this post


Link to post
Share on other sites
I don't know about performance differences, or even the filter used, the main advantage is the fact the process is determinate as it can occur at a set time, the mipmap generation via automatic generation can occur at undetermined time in the future which is very bad thing when you are copying to the base level of a texture as there is no way to know when the mipmap chain will be updated.

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!