Android的OpenGL的错误:"其余的()LT;需要"而Android 4.4 [英] Android OpenGL error: "remaining() < needed" and Android 4.4

查看:178
本文介绍了Android的OpenGL的错误:"其余的()LT;需要"而Android 4.4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个错误,我不明白当我尝试推出运行Android 4.4系统的手机我的应用程序(这是一个摩托g如果这会有所帮助):

I am getting an error I do not understand when I try and launch my app on a phone running Android 4.4 (It's a Moto G if this helps):

java.lang.IllegalArgumentException: remaining() < needed

Exception thrown in Thread[GLThread 85832,5,main] java.lang.IllegalArgumentException: remaining < needed
at android.opengl.GLES20.glGetInteger v(Native Method)
at com.jme3.renderer.android.OGLESShaderRenderer.intialize(OGLESShaderRenderer.java:311)
at com.jme3.system.android.OGLESContext.initInThread(OGLESContext.java:215)
at com.jme3.system.android.OGLESContext.onSurfaceCreated(OGLESContext.java:187)
at android.opengl.GLSurfaceView$GLTread.guardedRun(GLSurfaceView.java:1501)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

当我运行在的Xperiaü完全相同的code运行Android 4.0运行良好。这是怎么回事,什么步骤我可以采取以确保我的code上的各种设备上运行?

When I run the exact same code on an Xperia U running Android 4.0 it runs fine. What is going on here, and what steps can I take to make sure my code runs on a variety of devices?

推荐答案

glGetIntegerv() Java绑定的一个变体接受一个 IntBuffer 参数来保存多个返回值。如果您的请求需要更多的空间比缓冲区保存,您将收到此错误。

One variant of the glGetIntegerv() Java bindings takes an IntBuffer argument to hold multiple return values. If your request requires more space than the buffer holds, you will get this error.

旧版本jMonkeyEngine中没有为 GL_COM preSSED_TEXTURE_FORMATS 要求用一个固定大小的缓冲区。调用失败上支持过多种格式的设备。 (你应该查询 GL_NUM_COM preSSED_TEXTURE_FORMATS ,并使用该值大小的缓冲区。)在旧版本的Andr​​oid这实际上造成堆损坏,因为Java -language绑定做了比较错误的,允许将数据写入过去 IntBuffer 结束时(<一href="https://android.googlesource.com/platform/frameworks/native/+/42137d2e72cebb41f70c4a306877587fd0ea8c20"相对=nofollow>固定)。

Older versions of jMonkeyEngine did a request for GL_COMPRESSED_TEXTURE_FORMATS with a fixed-size buffer. The call failed on devices that supported too many formats. (You're supposed to query GL_NUM_COMPRESSED_TEXTURE_FORMATS, and use that value to size your buffer.) On older versions of Android this actually caused heap corruption, because the Java-language bindings did the comparison wrong and allowed the data to write past the end of the IntBuffer (fixed).

您可以看到jMonkeyEngine 这里。由异常的行数量来看,你正在使用的版本jMonkeyEngine的是pre-日期的修补程序。

You can see the fix to jMonkeyEngine applied here. Judging by the line number in the exception, you're using a version of jMonkeyEngine that pre-dates the fix.

这篇关于Android的OpenGL的错误:&QUOT;其余的()LT;需要&QUOT;而Android 4.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆