Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

image is not a power of 2?

So, i've made the raindrop tutorial project by libGDX. However, when i attempt to deploy it to the emulator i get an error saying that the image is not a power of 2. But i did re-size the images to be 48X48 using GIMP (as the tutorial had suggested). I believe he had added in some code to ensure that it would be possible to add in images that were not necessarily a power of two?

Does anyone know how i would fix this? Making it a power of two is a bit limiting.. isn't it? I followed the tutorial very closely! So... i'm not sure where to go from here. Noob at libGDX.

LogCat Dump:

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: { }
like image 662
BigBug Avatar asked Jun 11 '12 00:06

BigBug


1 Answers

48x48 is not a power of two. The app requires OpenGL ES 2.0 as stated in the text. The standard emulator only runs OpenGL ES 1.0. You can rescale the image to 32x32, then everything will work as expected on OpenGL ES 1.x as well.

I'd recommend not using the emulator for testing OpenGL ES apps. Use a real device instead.

like image 75
badlogic Avatar answered Oct 21 '22 13:10

badlogic