在modelBatch.render Android应用强行停止 [英] Android app force stop on modelBatch.render

查看:2169
本文介绍了在modelBatch.render Android应用强行停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想呈现libgdx模型 - 一切都完美地运行在桌面上,但对 modelBatch.render机器人强行停止(poleInstance,环境);

I'm trying to render a model in libgdx - everything runs perfectly on the desktop, but on android force stop on modelBatch.render(poleInstance, environment);

日志:

03-30 16:37:40.317    5249-5249/? E/cutils-trace﹕ Error opening trace file: No such file or directory (2)
03-30 16:37:42.621    5269-5269/? E/cutils-trace﹕ Error opening trace file: No such file or directory (2)
03-30 16:37:46.181    5283-5283/com.badlogic.gdx.tests E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from GradienCache
03-30 16:37:46.209    5283-5283/com.badlogic.gdx.tests E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
03-30 16:37:46.533    5283-5297/com.badlogic.gdx.tests E/EGL_genymotion﹕ [getAttribValue] Bad attribute idx
03-30 16:37:46.533    5283-5297/com.badlogic.gdx.tests E/EGL_genymotion﹕ tid 5297: eglGetConfigAttrib(605): error 0x3004 (EGL_BAD_ATTRIBUTE)
03-30 16:37:46.533    5283-5297/com.badlogic.gdx.tests E/EGL_genymotion﹕ [getAttribValue] Bad attribute idx
03-30 16:37:46.533    5283-5297/com.badlogic.gdx.tests E/EGL_genymotion﹕ tid 5297: eglGetConfigAttrib(605): error 0x3004 (EGL_BAD_ATTRIBUTE)
03-30 16:37:46.825    5283-5297/com.badlogic.gdx.tests E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 168
    com.badlogic.gdx.utils.GdxRuntimeException: File not found: com/badlogic/gdx/graphics/g3d/shaders/default.vertex.glsl (Classpath)
            at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:134)
            at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:78)
            at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:548)
            at com.badlogic.gdx.backends.android.AndroidFileHandle.length(AndroidFileHandle.java:167)
            at com.badlogic.gdx.files.FileHandle.estimateLength(FileHandle.java:229)
            at com.badlogic.gdx.files.FileHandle.readString(FileHandle.java:194)
            at com.badlogic.gdx.files.FileHandle.readString(FileHandle.java:187)
            at com.badlogic.gdx.graphics.g3d.shaders.DefaultShader.getDefaultVertexShader(DefaultShader.java:409)
            at com.badlogic.gdx.graphics.g3d.shaders.DefaultShader.<init>(DefaultShader.java:504)
            at com.badlogic.gdx.graphics.g3d.shaders.DefaultShader.<init>(DefaultShader.java:500)
            at com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider.createShader(DefaultShaderProvider.java:46)
            at com.badlogic.gdx.graphics.g3d.utils.BaseShaderProvider.getShader(BaseShaderProvider.java:34)
            at com.badlogic.gdx.graphics.g3d.ModelBatch.render(ModelBatch.java:269)
            at com.badlogic.gdx.tests.PathTest.render(PathTest.java:221)
            at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:391)
            at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
            at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
03-30 16:37:51.401    5283-5283/com.badlogic.gdx.tests E/AndroidGraphics﹕ waiting for pause synchronization took too long; assuming deadlock and killing
03-30 16:37:51.521      475-517/system_process E/InputDispatcher﹕ channel '528ce2b4 com.badlogic.gdx.tests/com.badlogic.gdx.tests.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

是的,我的问题是类似<一个href=\"http://stackoverflow.com/questions/19018357/cannot-run-libgdxs-animation3dtest-on-android\">this,但在更新库没有帮助
是的,文件 COM / badlogic / GDX /到位图形/ G3D /着色器/ default.vertex.glsl

Yes, my question is similar to this, but updating the library didn't helped And yes, file com/badlogic/gdx/graphics/g3d/shaders/default.vertex.glsl in place

我的code处这里

推荐答案

错误是找不到文件,那么显然它无法找到该文件。如果您确定该文件包括在内,这可能被重复引用(尽管它不具备)引起的。例如,如果您有(和出口)的核心和Android项目都GDX库。你可以通过右键单击每个项目检查,单击Java构建路径,然后订单和出口标签。确保GDX项目(或罐,这取决于你从源代码工作或夜间/稳定)仅包括(通过点击复选框导出)核心项目。

The error is File not found, so apparently it cannot find the file. If you are sure the file is included, this might be caused by duplicate references (although it doesn't have to). For example if you include (and export) the gdx library in both your core and android project. You could check this by right clicking each project, click on Java Build Path and then the Order and Export tab. Make sure that the gdx project (or jar, depending if you work from source or nightly/stable) is only included (and exported by clicking the checkbox) in the core project.

然而,在类路径中的资产​​(其中着色器文件)仅仅是为了支持外箱渲染libgdx。你的情况会建议着色器文件复制到(的子文件夹)Assets文件夹中,并使用这些替代。这使得管理你的资产变得更干净。您可以使用ModelBatch的构造函数,例如加载着色器:

However, having assets (which the shader files are) on the classpath is merely to support out-of-box rendering for libgdx. In your case would advise to copy the shader files to (a subfolder of) your assets folder and use those instead. That makes managing your assets a lot cleaner. You can load the shaders using the constructor of ModelBatch, e.g.:

modelbatch = new ModelBatch(Gdx.files.internal("data/default.vertex.glsl"), Gdx.files.internal("data/default.fragment.glsl"));

当然,你仍然可能要仔细检查你的项目配置。

Of course, you still might want to double check your project configuration.

这篇关于在modelBatch.render Android应用强行停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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