Photo Cube Link

Photo Cube Link
Photo Cube Version 3.2 now available!

Monday, July 18, 2011

New Version 1.14

Thanks to a kind customer who emailed me I was able to fix a very annoying yet rare bug, and uploaded version 1.14 last night.

When running Photokube the code draws the background with the OpenGL command glDrawTexiOES, then draws the cube and panels. However on the Android emulator on my pc, the background has always been displayed in front, obscuring the cube and the floating panels, despite me asking it to be drawn behind the kube.

Since it has always appeared correctly on all the phones I have tested, I assumed that it was some sort of bug with the emulator and Open GL. As no one mentioned the problem in the market, and after searching for similar issues on Google I found a few similar complaints about the emulator I came to the conclusion that it was the emulator at fault.

However, Tim emailed me to let me know he had been having the same issue on his phone, so I was forced to revisit it. Thinking about it again, it was really pretty unlikely that if it was an emulator issue, I would only have found a few references to it, it would have been a known issue.

Anyway, more Googling of glDrawTexiOES and z-order depth brought up quite a few people having issues in general, so I was able to narrow it down to Depth Testing in OpenGL, specifically the GL_DEPTH_TEST.

Previously I had depth testing enabled all the time, which seemed sensible, but what seems to fix the issue on the emulator and also work on phones is disabling Depth Testing when drawing the background, then immediately enabling it again before I draw the cube and panels. This doesn't seem logical to me to be honest, I can see why it is needed for drawing the cube, so the panels appear behind the cube, but I don't see why leaving it enabled also doesn't work for the background. Still, now it works for Tim and hopefully any others who had similar issues.

I don't really have the time at the moment but if I get the chance I will research it in more detail so I can really understand why it behaves this way.

Anyway, hope that solves the issue for anyone else. New version on the Market now.

No comments:

Post a Comment