Reputation: 12616
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:
Do you think if it would be faster to use OpenGL and the GPU than using a CPU-based BLIT library?
Thanks!
Upvotes: 3
Views: 4720
Reputation: 5351
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.
Upvotes: 5
Reputation: 56357
Depends, if the images are big, it might be faster using OpenGL. But if it's just doing the resize process and no more processing on the GPU side, then it's not worth it as is very likely that is going to be slower than the CPU.
But if you need to resize the image, and you can implement further processing in OpenGL, then is a worthy idea.
Upvotes: 1