Jump to content
  • Advertisement
Sign in to follow this  
jorgevegas

OpenGL resize image OGL

This topic is 3775 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, I couldn't find any thread solving my problem and that is why I am posting this one. Sorry If someone wrote something about it. My problem is, I have an Image in memory and I need to resize it. Sometimes to bigger dimensions and sometimes to smaller. The problem is that I know how to do it using C++ but I need to do it faster, maybe using the GPU instead of the CPU. I had tought on loading the image in OpenGL, scaling it and then copying the pixels again to RAM, where I need them, but I cannot figure out how to do it. Does anyone know how to do it? I accept other suggestions If there are. My point is: I have an image in RAM (RGB format), I need to resize it and place it again in RAM. CPU is too slow for my needs. Thanks in advance Jorge

Share this post


Link to post
Share on other sites
Advertisement
1.) Make a renderable texture of the required size.
2.) Draw a fullscreen quad with the input texture to the renderable texture (for example by using identity modelview and projection matrices, and using vertex coords with x and y = -1 or 1.
3.) Read back the rendered texture.

I'm not sure if using OpenGL is the quickest way though since you first have to push the original image to video memory and then read the rendered image back. Especially the latter operation is quite slow.

Share this post


Link to post
Share on other sites
Hello,

Thanks for your reply Lord_Evil. I achieve to do it using textures.
Now I'm trying to use an offscreen buffer to render it. But is going well.

Thanks again

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!