Wednesday, 5 October 2011

iPhone4S, iOS5 & Ground Effect in Glasses free 3D

Like a lot of people all over the world I was glued to Apple's presentation yesterday. I had two different live blogs and two twitter windows open at the same time.

The 4S looks cool but do I need those features? The new camera looks great but it was good before and those tiny optics are never going to do the job of even a decent compact camera, let alone a real one and 1080p? I've shot maybe two minutes of 720p in my iPhone4 since i've had it.

Of course, as a dev, having something with the power of an iPad2 in my pocket is going to be cool but I don't NEED it, not when i'll have to support iPad1 and iPhone4 for a few games anyway. I have to admit, I'd trade all of the new features for a screen the size of some of the new Android phones.

Anyway, I felt slightly dirty afterwards, as if I'd watched X-Factor or something. At least I could kid myself I was really there for news of the iOS5 GM. I set off downloads for the new XCode, iTunes and the device OSes and a mere four hours later (yeah I know, stupid local cable company stops 30 metres from my home) I had them.

I've had two iPhone/iPod/iPad cables (both falling to bits, like every other dev) hanging out of my mac for a couple of months now and often have two devices plugged in at the same time. I've been impressed with how well iTunes and XCode handle having two devices connected. I thought I'd give iTunes a proper test so I stupidly upgraded and re-synched my phone and iPad at the same time. To my amazement it worked perfectly.

I was rather less impressed with what happened when I tried to build Topia with the new XCode and run it on the new OS. All I got was a blank screen and the music. On trying a debug build OpenGL was throwing up an error on a line of code that hadn't changed for over six months. After a few hours of very depressing and unproductive hacking around I finally went to bed at about 3:30.

I woke up five hours later, instantly remembering that my code was broken. I'd been kind of hoping I'd somehow fix the bug in my sleep and wake up with the answer which isn't the most reliable debugging technique but has worked for me several times over the years. I staggered to the mac and waited for my eyes to focus (getting old is shit) and found myself staring at this line of OpenGL documentation I'd left open last night.

"... The numbers in the command name are interpreted as the dimensionality of the matrix. The number 2 indicates a 2 × 2 matrix..."

Pretty exciting stuff to wake up to I think you'll admit. Weirdly, the answer was there, turns out that where I should have been using:

  glUniformMatrix4fv(parameter, 1, GL_FALSE, matrix);

I had been using

    glUniformMatrix4fv(parameter, 4*4GL_FALSE, matrix);

The real question is how the hell did it ever work before? Anyway, changing that has everything working again, possibly a little faster than before, certainly no slower, which is a big relief on a new OS version. I can't be arsed with getting accurate timings right now to be honest. I might even go back to sleep when I finish typing this...

In other news yesterday, Jeremy from Jakyl who did a great job of the Android version of Ground Effect released a new version which supports the glasses free 3D on the lovely big screens of the HTC Evo 3D and LG Optimus 3D. Sadly it is of course impossible to show how cool this is in a screenshot so here is a quick Topia closeup instead, showing the new soft animal shadows and the footprints we're using to guide herds.

No comments:

Post a Comment