I am afraid that at the moment this is not possible. All OpenGL state containing texture size has now been removed (according to GLES 2.0.25 specifications). As you correctly stated, there is no error loading the texture (this is sad in design). Proxy texts were deleted, and people reported that they were often not supported / interrupted on a PC class GPU. So what now?
You can try and read the contents of the texture back through the framebuffer object (maybe not the whole texture, but only corner points / every 32nd pixel / ...). It would not be very fast, but it should work. You might also be able to use frame fullness checking with an attached texture (but this, apparently, is limited only by the internal image format, which may or may not be installed if texture loading fails due to low memory - you will have to check this) .
You can (theoretically) determine the amount of available memory by creating a renderbuffer object, the specification states that glRenderbufferStorage () will end with GL_OUT_OF_MEMORY, so this should be fairly reliable.
It would be fairly easy to test the free space before distributing the texture, and then remove the rendering buffer (if successful), and then select the texture itself. Keep in mind that with mipmaps, the texture will take a little more than 1.33x for the base layer.
It would be even better to determine the available memory at application startup (perhaps after compiling shaders and allocating other objects where it is not easy to estimate the amount of memory) and monitor the distribution of objects to see how much memory is left. This seems complicated, but if OpenGL objects are wrapped in classes, it should be pretty easy.
source share