Question

Now, I can save texture by using glReadPixels() to read the data in framebuffer (FBO). However, I faced two problems.

(1) In order to keep the saved image quality, the dimension would be larger than GL_MAX_TEXTURE_SIZE (most devices is 4096). If I created big texture (ex: 4160x3120), I got GL_FRAMEBUFFER_UNSUPPORTED error when calling glCheckFramebufferStatus()....

(2) If I created small texture(ex: 3648x2736), everything works except glReadPixels() will be very slow....

So back to my question, is it possible to overcome max texture size limitation and save it efficiently? Thanks.

Was it helpful?

Solution

1) No, it's not possible unless you want to somehow process the image in multiple, smaller pieces. I don't remember seeing a device with bigger GL_MAX_TEXTURE_SIZE than that, so you won't be able to create a FBO bigger than that.

EDIT: Actually, there is quite a number of devices where the maximum texture size is 2048, although 4096 is typical in most recent devices.

2) You should understand that that is already a very large texture, not a small one, so glReadPixels() will be slow. I'm not sure there's a way around this on Android.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top