oF for iPhone

This weekend I worked on porting ofGraphics and ofTexture to openGL ES, which is used on the iPhone. The biggest difference I have encountered so far is that you don’t have glBeginShape and glEndShape. Instead you use glVertexPointer and glDrawArrays. I can draw simple shapes and I can *almost* print a texture using ofTexture, but I have never worked directly with openGL, so it is slow going, but I am learning tons. Here-is-the-openGL-ES-documentation.

It would be pretty trivial to make an Objective-C shell app like SimpleApp that is a subclass of UIView, just like in the OpenGL Application template in the iPhone SDK. You have functions like touchesBegan, touchesMoved, and touchesEnded, and within them you can use plain C++ code, so it won’t be too much of a jump for OF users.

Anyone interested in helping out with this at the OF Knitting Circle at Eyebeam on Wednesday?

Just one quick gotcha I discovered while doing this:

There is no glColor3f(), but glColor4f is there, I almost embarked on hours of workarounds before discovering that.

There is no GL_QUADS, but you can use GL_TRIANGLES.

There are no display lists, but you’ve got vertex arrays (no VBOs as far as I know )

I’ve uploaded the wrapper I wrote to convert the display list code to here:


wherever I was building display lists I instantiated one of these and added the vertices or whatever into it like I was before, calling draw on it insteand if glCallList( LIST_ID ) like I was before.

There is also code there that I lifted from MESA to do gluOrtho2D and that sort of thing, have to make sure that is legal before I release.


havent had too much experience (a little though) developing stuff in obj-c or for the iphone. Very interested in taking a crack at it though. I’ll be at the knitting circle

I’m interested too and can try to help - I know andrew was working on this a few weeks ago, not sure how far he got with his research but i did see some random colored pixels :slight_smile: – zach

in case anyone is still digging into this, I found this obj-c for c++ guide a few hours ago and it’s been invaluable :


Is anyone still hacking away at porting OF to the iPhone?

I’m working on setting up a glut-like context for doing multi-touch opengles based sketches for the iPhone. If anyone has any code in progress, I’d love to swap code to see what’s happening

might be worth getting in touch with this guy?

Don’t know if getting GLUT working is the big hurdle but if it is then the person in the link should be able to help.


i think megamu=leebyron


wow - duh!
that makes sense.

here is another link to more info about Lee’s GLUT/C++ iphone development

I love yellow tail and it looks super hot with multitouch!

looking forward to checking out the code,


wow this looks very promising!

cant wait to see that code

Sorry for the self plug, but i just posted this on pixelsumo which is more of a discussion point than technical. Quite exciting possibilities I feel.


i’m now the proud owner of an iPod Touch - what’s the status of oF for iPhone these days?

damnit - it’s not yet jailbreakable! stupid bloody drm.

I would also appreciate an update on this, as I am getting into iPhone developing and having OF for use on there would be a dream come true. (Now I just have to learn Objective C…)

Any updates? Zach told me that you guys had worked out some pretty cool ports for iPhone. Is there a beta package floating around that I can look at?

there are currently two versions floating around. the first was done by lee byron and zach gage, and is called mobileframeworks:


there is an svn there and an empty example. there is also a google mailing list for that, but it’s not really active yet.

the second, which is essentially a working in of iphone specific stuff into the OF codebase, ie #define TARGET_IPHONE, is done by damian frey. I don’t know if that’s up online now, but I know that damian’s had good luck compiling some libraries (freeType) for iphone, but some other libraries (freeImage) aren’t done yet (and could likely be replaced with apple / qt specific stuff). the plus side of this approach is that the majority of the OF code stays the same (and certain things, like ofGraphics, are opengles-ified), while the MF is essentially a rewrite.

hope that helps gives a status -

take care!

man, love to see what comes from this knitting circle thing. I’m typing this from my new iPod touch, by the way. Does anyone know of any iPhone apps (see 2nd gen, inb4 jailbreak) that can compile C/C++?