Sunday, February 19, 2012

BarCamp Miami 2012

Gave talk about Galaga enemy patterns at BarCamp Miami 2012. Here is a photo of me explaining some z80 assembly code. :)

Saturday, February 11, 2012

Android OpenGL ES 1.x

I needed to do a review of OpenGL ES. It has been a while since I've done any OpenGL programming. I found a nice series of OpenGL ES 1.x tutorials here:

http://www.zeuscmd.com/tutorials/opengles/index.php

I ported all of the zeus tutorials (except the first five) to Android 2.3. They can be found here:

https://github.com/machinezilla/ZeusOpenGLESTutorials

Some notes:

  • FloatBuffer.put is slow - see this wiki entry: http://www.badlogicgames.com/wiki/index.php/Direct_Bulk_FloatBuffer.put_is_slow -- this doesn't really affect the tutorial performance but it is something to keep in mind if you plan on doing complex scenes. For my purposes FloatBuffer.put performance is fine. I came across this while porting tutorial #21 which dynamically updates the vertex array in order to swap z-values of the flag vertices.
  • Don't bother with transparent TGAs just use transparent PNGs. No need to write any special tga loading code. Just convert the transparent tgas to transparent pngs and let Android SDK do the heavy lifting. Had to do this for tutorial #24.
  • I was able to reduce the amount of tutorial scaffolding code by relying on the Android SDK. The later tutorials require a way to load textures. You can use Android asset manager to handle all of this for you.

I really enjoyed the following zeus tutorials: #20 transparency -- it was really cool to see the texture blending cause a glowing effect; #23 masking -- this effect reminds me of old console game intro screens; #25 reflections -- very cool effect simulating reflection using stencil buffers I've never done this before so I didn't realize the effect was accomplished by essentially having to render a mirror image of a scene.

Tutorial 25 Reflections