I’d like to resize an image using OpenGL. I’d prefer it in Java, but C++ is OK, too.
I am really new to the whole thing so here’s the process in words as I see it:
- load the image as a texture into OGL
- set some stuff, regarding state & filtering
- draw the texture in different size onto another texture
- get the texture data into an array or something
Do you think if it would be faster to use OpenGL and the GPU than using a CPU-based BLIT library?
Thanks!
Instead of rendering a quad into the destination FBO, you can simply use hardware blit functionality:
glBlitFramebuffer. Its arguments are straight forward, but it requires a careful preparation of your source and destination FBO’s:glCheckFramebufferStatus)glBindFramebuffer)glDraw/ReadBuffers)glBlitFramebuffer, setting GL_LINEAR filter in the argumentI bet it will be much faster on GPU, especially for large images.