Bitmap too large to be uploaded into a texture

北战南征 提交于 2019-12-11 03:17:58

问题


When I trying to render a bitmap in imageview

mImageView.setImageBitmap(mBitmap);

I would see Bitmap too large to be uploaded into a texture in log.

Ok, I know there is limit on OpenGl that would throw this warning message.
But can I know whether the image is rendered success or not?


回答1:


You should check maximum texture size by getting value of GL_MAX_TEXTURE_SIZE environment value.

You can review this value for various Android devices on site of GLBEnchmark: http://www.glbenchmark.com/phonedetails.jsp?benchmark=glpro25&D=Google+Nexus+S&testgroup=gl

To reduce video memory footprint you may want to use ETC1 textures. If you use OpenGL ES 2.0 you can use it straight away (ETC1 is part of GL ES 2.0 specs), if you use OpenGL 1.1 you should check for ETC1 support by looking in list of GL extensions.




回答2:


Probably not other than the pretty obvious "Is it on the screen?" answer. Just don't go crazy and you should be fine. You can do things like crop or resize a copy of the image to reduce the RAM footprint. I never tried this with a huge image, but Android usually does things like crash or slow down.



来源:https://stackoverflow.com/questions/13180382/bitmap-too-large-to-be-uploaded-into-a-texture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!