Fast cropping of a GLTexture
in
Core Library Questions
•
2 years ago
Hi all,
Using GLGraphics, I want to crop a GLTexture (src) and create another GLTexture (dest) as a result. One way of doing this is:
GLTexture dest = new GLTexture (this, dx, dy);
src.updateTexture();
dest.putPixelsIntoTexture (src, ox, oy, dx, dy);
Although this method works, the updateTexture() method is necessary and this method copies the texture data to the pixels property, trasferring data from GPU memory to CPU memory, which is a slow operation. All GLTexture cropping solutions I know are slow.
The copy() method in the GLTexture class doesn't allow to crop.
Is there any (fast) way of cropping a GLTexture without GPU-CPU memory transfer? Maybe this can be done with a GLSL shader but, being a complete dummy regarding GLSL programming, I can't figure out how to do it. Maybe a shader isn't necessary at all... any ideas?
Thank you very much in advance!!!!
1