因此,我已经通过libGDX制作了雨滴教程项目。但是,当我尝试将其部署到仿真器时,出现一个错误,指出该图像不是2的幂。但是,我确实使用GIMP将图像的大小调整为48X48(如本教程所建议)。我相信他已经添加了一些代码,以确保可以添加不一定是2的幂的图像?

有谁知道我将如何解决这个问题?使其为2的幂是有限制的..是吗?我非常仔细地阅读了本教程!所以...我不确定从这里去哪里。 libGDX的Noob。

LogCat转储:

06-11 00:22:50.942: W/dalvikvm(545): threadid=11: thread exiting with uncaught exception (group=0x409c01f8)
06-11 00:22:50.952: E/AndroidRuntime(545): FATAL EXCEPTION: GLThread 72
06-11 00:22:50.952: E/AndroidRuntime(545): com.badlogic.gdx.utils.GdxRuntimeException: Texture width and height must be powers of two: 48x48
06-11 00:22:50.952: E/AndroidRuntime(545):  at com.badlogic.gdx.graphics.Texture.uploadImageData(Texture.java:197)
06-11 00:22:50.952: E/AndroidRuntime(545):  at com.badlogic.gdx.graphics.Texture.load(Texture.java:179)
06-11 00:22:50.952: E/AndroidRuntime(545):  at com.badlogic.gdx.graphics.Texture.create(Texture.java:159)
06-11 00:22:50.952: E/AndroidRuntime(545):  at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:133)
06-11 00:22:50.952: E/AndroidRuntime(545):  at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:122)
06-11 00:22:50.952: E/AndroidRuntime(545):  at com.badlogic.drop.Drop.create(Drop.java:38)
06-11 00:22:50.952: E/AndroidRuntime(545):  at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:292)
06-11 00:22:50.952: E/AndroidRuntime(545):  at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1455)
06-11 00:22:50.952: E/AndroidRuntime(545):  at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)
06-11 00:22:51.041: I/AndroidInput(545): sensor listener tear down
06-11 00:22:51.041: I/AndroidGraphics(545): Managed meshes/app: { }
06-11 00:22:51.041: I/AndroidGraphics(545): Managed textures/app: { }
06-11 00:22:51.041: I/AndroidGraphics(545): Managed shaders/app: { }
06-11 00:22:51.041: I/AndroidGraphics(545): Managed buffers/app: { }

最佳答案

48x48不是2的幂。该应用程序需要文本中所述的OpenGL ES 2.0。标准仿真器仅运行OpenGL ES 1.0。您可以将图像重新缩放为32x32,然后一切也将在OpenGL ES 1.x上按预期工作。

我建议不要使用模拟器来测试OpenGL ES应用程序。请改用真实的设备。

10-08 17:09