Author: Kristian Golding

A dynamic texture engine for Frex

This moment has been a long time coming.  The first step I’d taken on this journey, and shown in previous posts, was to create a fractal scene piece-by-piece and then simply paste all the pieces together to create a final image.  The image was zoom-able but did not allow the user to pan in any direction.   I thought a good way to enable panning was to create a tile-based engine.  That is, the scene would be divided up into equal-sized square tiles and if the user panned from the left to the right, tiles to the left of the screen boundary would appear while visible tiles near the boundary to the right would disappear.   That seemed ok, and followed what existing tile-based game engines do (think Metroid or Super Mario Bros).  However with engines like that the tiles used to create the final image already exist.  For fractals, and their infinite nature, that can’t be done.

All the above lead me to create my own 2-dimensional dynamic tile engine using OpenGL ES, a programming interface for hardware-accelerated graphics on mobile devices.   For my method I create the required number of tiles (or polygons) to fill the screen (plus some buffer tiles around each edge), and then map onto each polygon an image (texture) with what the fractal would look like in that region. As the user swipes around the screen, a simple translation matrix is used to update the position of each polygon on the screen by the same amount.  If a polygon is moved off the screen, it will be translated to the opposite side of the screen with an updated texture representing that region of the fractal.  This gives the user the impression that they are panning around the fractal.

The below image represents the proof-of-concept stage of the tile engine.  Each square is 32 by 32 pixels and is textured by a bitmap of random colour.

Although the image is 800 x 480 pixels in size (the resolution of my phone screen), the OpenGL resolution is 480 x 320 pixels, explaining why there are only ten 32 x 32 squares horizontally. Currently it runs at around 70 frames per second. As it’s not doing any of the hard maths to generate fractal imagery yet (theoretically I can just plug-in the fractal generation routines I’ve already written), more interesting times are ahead if the frame rate is to stay high. For now I’ll be working with this simple version to weed out any obvious performance bottlenecks and ensure that zooming also works as intended before creating another fractal image.

I’m curious to find other ways of achieving my goals that I’m not aware of yet. Hopefully I’ll stumble across them in my googling.  As it stands, I really had to learn a lot about OpenGL to get this far; any previous experiences with it proved useful but completely inadequate in the end, and much swearing was done.  C’est la vie.

The very hungry caterpillar

I recently couldn’t help but notice that one of the shrubs in our back garden had been reduced from something like this:

DSC_4379.jpg

To this:

DSC_4380.jpg

I thought that my mind had wondered while spraying for weeds a few days prior, and I’d accidentally killed most of it. However, while out watering I noticed something about the size of my little finger clinging to the side of one of the newly bare stems.

DSC_4374.jpg

It’s the caterpillar of an Io moth. I was fascinated by the spines (which are actually poisonous, but not greatly) and the brown and white stripe running along the length of the caterpillar. Luckily it was early enough in the morning and wasn’t in a rush for work, so unpacked the monopod and macro lens and set to taking some shots. It ate most of the shrub, the least it could do was pose for me.
DSC_4355.jpg

DSC_4350.jpg

A few more shots can be found here.

The interesting part is that I currently don’t know where it is. I did see it on an adjoining shrub at one point, although it hasn’t left a trail of destruction. My only guess is that it has made a cocoon down near the base of the new shrub. I’m sort of hoping it is a male, as it will fly away to try and find a mate and then I won’t have to kill offspring. The female however tends to remain in place, waiting for a male to arrive (in moth form life lasts for only a day, so things have to happen fairly quickly), and that means things could get messy when I bring out the killing spray.  But I’ll try and get some more photos first.

So those Australia photos

A long time ago in a land far, far away, Adriana and I caught up with family and friends. And then I fell into some sort of Internet coma. I showed some signs of consciousness with Frex (still working on it), and now here I am with another post.

So, Australia.

We went to Oz back in May. I’d never been to Uluru before, even though I’d been to Alice Springs for a wedding (it’s not really that close to Uluru, but while you’re in the general area…), but at the time I was a university student with no money, and getting a day trip to the rock was well out of my price range. This time around I wasn’t going to miss it, so decided that a 3-day camping tour out of Alice Springs would be the ticket. We had a couple of days in Alice Springs to catch up with friends I hadn’t seen in yonks, acclimate (that is, let all the Florida humidity I’d acquired over the years evaporate), and try and sync up with the timezone. We also accumulated enough red dust to last us till we returned to Florida.

My friend’s two older kids were a hoot and we had a lot of fun with them.
Darcy and Amy

The Alice Springs Desert Park was large, open, and relaxing. We got to see some pretty cool bird shows:
DSC_2959.jpg

As you walked around the park, there were many Crested pigeons (I love these guys) basking in the sun:
Crested pigeon

The park provided awesome views of the huge open skies above the Macdonnell ranges:
DSC_3022.jpg

And a go-anywhere four wheel drive out in the car park:
DSC_3027.jpg

We then went to see the Alice Springs Reptile Centre, a quaint little place that allowed us to get up really close with some reptiles. It was pretty cool, and Adriana does what she always seems to do when holding a snake: making out she’s going to eat it.

DSC_3036.jpg

That’s a pretty quick summary of Alice Springs before we went on the camping tour, which turned out to be awesome and bloody cold at night. But, that’s for another blog post, standing up too fast can make one feel light-headed.  The flickr set for all of this is here.

Frex – with zoom

After a lot of refactoring, Frex now has a code base that I can understand the next day. I took the opportunity to install version control on my laptop to save me from any potential “oh f%*k” moments, or at least make them not as bad. I chose subversion for this, and as the repository is located in my dropbox folder, I’m not worried about having to back it up.

I created a list of features I wanted this thing to have, and along with some speed and user interface improvements, the big feature I added for this version was zoom. This is a screenshot of the app running on my phone, showing a zoomed-in portion of the Mandelbrot set:

Frex zoom