我试图在libgdx中渲染一个模型 - 一切都在桌面上完美运行,但在android上停止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!
是的,我的问题类似于this,但更新图书馆并没有帮助
是的,文件com/badlogic/gdx/graphics/g3d/shaders/default.vertex.glsl
到位
我的代码放置here
答案 0 :(得分:1)
错误是File not found
,显然无法找到该文件。如果您确定包含该文件,则可能是由重复引用引起的(尽管它不必)。例如,如果在核心和android项目中包含(并导出)gdx库。您可以通过右键单击每个项目来检查这一点,单击Java Build Path,然后单击Order and Export选项卡。确保在核心项目中仅包含gdx项目(或jar,取决于您是从源或夜间/稳定工作)(并通过单击复选框导出)。
但是,在类路径上拥有资源(着色器文件)只是为了支持libgdx的开箱即用渲染。在您的情况下,建议将着色器文件复制到您的资源文件夹的(子文件夹)并使用它们。这使得管理资产变得更加清晰。您可以使用ModelBatch的构造函数加载着色器,例如:
modelbatch = new ModelBatch(Gdx.files.internal("data/default.vertex.glsl"), Gdx.files.internal("data/default.fragment.glsl"));
当然,您仍然可能需要仔细检查项目配置。
答案 1 :(得分:0)
请在Arm Transition
Genymotion Emulator
以下是有关如何安装此转换的详细指南:
How to install Google Play Services in a Genymotion VM (with no drag and drop support)?
我希望这会有所帮助。