The game I'm developing renders perfectly on the Java backend and on IE 10. However the rendering on Chrome and Android is weird. I'd assume this was because of WebGL & OpenGL respectively.
Here's how it looks on IE.
Here's how it looks on Chrome, and it looks exactly same on the Android backend as well.
The background did not get rendered, and only the first and last text elements got rendered
Are the any restrictions on texture size etc when running in Chrome and Android, anything in particular I have to take care of? All my textures have dimensions the power of 2s. I even tried creating every surface with dimensions the power of 2s, but it doesn't seem to help.
Update: I fixed the following issue. It was due to a bug in the UI toolkit I had written, where a new surface was getting created every time a widget's text was set.
I'm not sure if the following problem is related, but sometimes the game crashes on Android with the following exception:
03-16 14:22:29.010 E/AndroidRuntime(16253): FATAL EXCEPTION: GLThread 10
03-16 14:22:29.010 E/AndroidRuntime(16253): java.lang.StackOverflowError
03-16 14:22:29.010 E/AndroidRuntime(16253): at playn.android.AndroidPlatform.log(AndroidPlatform.java:28)
03-16 14:22:29.010 E/AndroidRuntime(16253): at playn.core.PlayN.log(PlayN.java:120)
......
......
......
playn.core.gl.GLContext$Pender.process(GLContext.java:242)
03-16 14:22:29.010 E/AndroidRuntime(16253): at playn.core.gl.GLContext$Pender.process(GLContext.java:242)
03-16 14:22:29.010 E/AndroidRuntime(16253): at playn.core.gl.GLContext$Pender.process(GLContext.j
This is because at http://code.google.com/p/playn/source/browse/core/src/playn/core/gl/GLContext.java, GLContext$Pender.process() seems to be called in a never ending cycle. This doesn't happen every time, though.
I was looking at the TriplePlay library's source code when it occurred to me that I can draw images only in paint(). I used to copy portions of images from a spritesheet to different widgets. The copying was done during widget creation which typically occurred in response to a touch event. When I switched the image copying to inside paint(), it started working perfectly.