iOS OpenGL ES compatibility gotcha

Oh man, I just wasted too many hours of my life trying to figure out why calls to glBlitFramebuffer in my iOS app were returning GL_INVALID_OPERATION. I was targeting iOS 7, so I should’ve been able to use OpenGL ES 3.0 calls, and after all, I’d built against the v3 headers and everything else was compiling and working… right?

Wrong. Well, I really should’ve RTFM. It turns out that ES 3.0 use is not determined just by the OS version, but by the hardware. So even if you’re running iOS 7, you can only use ES 3.0 if you’re on the latest gen: iPhone 5S, iPad Air etc. Check out the full compatibility matrix here.

Here are a few extra tips to help you avoid wasting your time like I did if you’re explicitly targeting OpenGL ES 3.0:

  • As well as running on the right hardware, you can also use the simulator, which supports emulation of v3.0.
  • Call glGetString(GL_VERSION) to get a report of which version you’re actually running.
  • Pass the appropriate parameter to EAGLContext initWithAPI, if you’re using it.
    e.g.

     self.context = [[EAGLContext alloc] initWithAPI:
        kEAGLRenderingAPIOpenGLES3];
    

It’s pretty frustrating that you get no indication that the function’s not supported, as opposed to just having being passed bad state. But I guess that’s par-for-the-course with a bare-bones, down-to-the-metal API like Open GL.

Sigh.

Posted in Debugging, iOS, Software Development | Tagged , , , | Leave a comment

SpriteKit for Cocos2D developers

spritekit logoOn my recent iOS puzzler Wordz, I decided not to reinvent the wheel, and instead use an off-the-shelf 2d game framework. I settled on Cocos2d. It makes it very easy to put together sprite-based games or apps by providing all the basic pieces like a scene graph, animations and integration with a couple of physics engines. It’s built on OpenGL but, happily, hides all that away from you – unless you need it.

No sooner had I released it, than Apple came out and announced a new framework for 2d games: SpriteKit. And it’s remarkably similar to Cocos2d. Here I’ll take a look at a few places where they differ, so you know what to look out for if you’re considering migrating to SpriteKit.
Read More »

Posted in Graphics, iOS, iPhone, Uncategorized | Tagged , , , , , , , | 1 Response

Dynamic D3 with Knockout.js

A couple of things happened recently that prompted me to write this blog post. Firstly, I’ve been playing around with HTML5/javascript based user interfaces and data visualisation. Secondly, I watched a fascinating presentation from UX guru Brett Victor, making me wonder if it was possible to create an interactive, data-drawing app like the one he demonstrates, purely with Javascript. There are 2 well established JS frameworks that we could combine to help us here: Knockout.js and D3. But can we make them work well together?
Read More »

Posted in Graphics, Software Development | Tagged , , , | 3 Responses

A short (and round) history of the button

Early MacOS OK and Cancel buttons

Early MacOS OK and Cancel buttons

The push button. It’s truly the blunt instrument of UI design. While most other controls provide some indication of the type of operation they’re performing – sliders are adjusting a value, a switch is moving between two states – buttons just mean “do something”. What? The only way to tell is to press it and see. But this shouldn’t be the case.
Read More »

Posted in Graphics, Mac, Usability, Windows | Tagged , , , , | Leave a comment

An iOS Lava Lamp using OpenGL ES shaders

screenshot

Screenshot of the finished lava lamp effect

Catchy title, eh? This little experiment came about as I’ve been working on an iOS app where I decided to use an embedded OpenGL view, via GLKit, for a bit more flexibility than a plain-old UIView. This found me falling head-first down a rabbit-hole of OpenGL ES shaders. I ended up putting together a little demo that emulates a lava lamp using a nifty bit of GLSL code.
Read More »

Posted in C++, iOS, iPhone, Mac, Software Development | Leave a comment

Examining PDB files with DBH

Wow, it’s been a ridiculously long time since I’ve blogged. I think it’s time I put something up just to break the curse, and this seemed like a good, and hopefully useful, place to start. Time to polish some of these dusty drafts into published gems.

Ever been in that situation where you (or someone else) finds that Visual Studio just won’t set a breakpoint in some source code that you’re sure should be being used? You’ll see the hollow breakpoint icon and something like ‘The breakpoint will not currently be hit. No symbols have been loaded for this document’.
Read More »

Posted in Debugging, Software Development, Visual Studio, WinDbg | Tagged , , , , , | 1 Response

Beginning F#: Records

In the second of an unknown number of parts in my series of Beginning F# posts, I’ll be talking about record types. They’re a useful and powerful F# feature that you’ll probably find yourself using very widely. I’ll take a look at what they are, how they’re used and how they integrate with the rest of the language.
Read More »

Posted in F#, Software Development | Tagged , , , , , | 2 Responses

.NET DLLs Loaded Twice

If, like me, you’re still squeezing yourself into 32-bit Windows processes, you’re probably, also like me, constantly keeping an eye on the virtual address space usage of your application. If you happen to have used something like vmmap to take a peek at your memory contents, maybe you’ve noticed something strange with some .NET assemblies: they’re loaded twice! What’s going on…?
Read More »

Posted in .NET, Debugging, Windows | Tagged , , , | 4 Responses

30 years ago at CES…

candvg_logoThe other day while I was looking through some of my ancient copies of Computer and Video Games magazine (“the first fun computer magazine!”) I discovered some coverage of the 1982 Consumer Electronics Show. It’s such a contrast to today’s shiny, immaculately produced, PR-fest that I couldn’t help but scan it in for everyone to see.
Read More »

Posted in Gaming, Graphics | Tagged , , | Leave a comment

Tax Avoidance 2.0

dislikeWarning: This is a bit off-topic for my blog, but I had to write it and get it off my chest.

In these times of financial woe, people love to complain about all the big, nasty, faceless companies avoiding paying tax. They inevitably moan about it on Facebook, Google and Twitter (and sometimes even do something about it in the real, physical, world). But what about those companies themselves? The Web 2.0 behemoths are now some of the largest companies in the world, and they’ve decided – just like the evil old companies – that they don’t like paying all that tax. Don’t be evil… and don’t pay any tax if you can help it. But how do they do it?
Read More »

Posted in Finance, Rant | Tagged , | 3 Responses
  • Follow me on Twitter Follow me on Twitter @voyce

  • Check out Wordz my new fast-paced make-a-word game for iOS.
  • Categories

  • Archives