Posts Tagged ‘iphone’

openFrameworks iPhone 3GS / OS 3.0

Tuesday, July 14th, 2009

i’ve been dealing with a performance bug in a particle + accelerometer oF app. the same project which has run very smoothly on a first generation iPhone with OS 2.2.1 has a noticeable stutter on an iPhone 3GS with OS 3.0.

there was no improvement despite several rounds of optimizing the openGL drawing code and plugging several memory leaks.

finally, in frustration i bumped the explicit frame rate declaration from the default 60 fps to 120 fps. i realize that ofSetFrameRate(60) is merely the upper limit of the frame rate, and that the hardware won’t actually go faster than it can handle, however this immediately improved performance on the 3GS and the first gen is about the same as it was. further improvement was had with a declared frame rate of 240 fps.

i haven’t had a chance to look into the underlying issue, but i believe that oF is using NSTimer under the hood to trigger a scheduled update() and draw(). has there been some change in the SDK there?

…little help (oh, malloc)?

Monday, July 6th, 2009

i’m having a time of it tracking down a resource allocation bloat culprit in an iPhone app i’m working on. i’ve narrowed it down to when i’m rapidly updating the center property of a UIImageView. a snippet from the Instruments application is below:

malloc


there are hundreds (if not thousands) of these messages, and the object allocation graph trends steadily upwards. when i disable the portion of the method which updates the center property the allocations stop and the memory usage goes flat. this also only occurs on the device…the simulator does not exhibit this behavior.

i’m using UIImageView directly, without subclassing, and it contains data from a small PNG file. i’ve patched up several other leaks successfully today, and really wanted to nail this one too.

(overly simplistic) saving state in oF for iPhone

Friday, June 19th, 2009

save_stateThere was a recent comment about saving / restoring application state when using openFrameworks for iPhone which got me to thinking about how to do it. Apple’s frameworks provide a fairly thorough way to save state to the disk and restore later. There seem to be three primary ways to do this: simple plist files (usually encoded in binary on the iPhone), archived data (they like to refer to this as freeze-dried object graphs) and core data.

I believe that archiving objects require methods inherited from NSObject, which we don’t have in openFrameworks’ ofSimpleApp. Core Data seems like overkill, so I looked into using plist files.

There are likely better ways to do this, but this ad-hoc solution works wonderfully for a small app I’m working on, and only requires a bit of Objective-C code that could likely be moved up into a nice wrapper class. However, since the question was asked I’d just like to get it out there before working on a more elegant approach. (more…)

openFrameworks knitting circle

Wednesday, June 10th, 2009

Had a really nice time tonight at the oF knitting circle held at Parsons in NYC. Saw several really inspiring projects and spoke to several people about using openFrameworks for iPhone development and showed the current version of the particle game using ofxiPhoneAlertView.

Quite a few folks mentioned that they have become interested in openFrameworks after hearing about it’s use for creating iPhone applications. While not every app is suitable, I saw a few really nice examples. My only regret is not getting the name of the fellow who was working with creating a sound wrapper.

The wiki page for the knitting circle is at the openFrameworks wiki.

ofxiPhoneAlertView

Wednesday, June 10th, 2009

Here is a (really) basic wrapper for the UIAlertView in openFrameworks of iPhone. Not all of the necessary delegate methods have been implemented yet, but this is enough for me to get the proof of concept rolling in an app I’m building.

Feel free to let me know how I can do things better, or just tinker with the code directly at github: ofxiPhoneWrappers

Check out the example project. This is a bit of a kludge. I would like to figure out how to avoid having to declare main and testApp as mixed source files (.mm). It works for now, however.

Here are the notes on using the class: (more…)

BarCampNYC4 presentation

Wednesday, June 3rd, 2009

BarCampNYC4 was hosted by ITP on May 30-31st. It was a great event – I’d highly recommend going to another one.

I did a presentation titled “Using openFrameworks for iPhone App Development” which I think went well, although it was quite dense. Can’t be helped, I suppose. The walk-through of getting set up with openFrameworks has been previously posted, and is also available on ITPedia. Below is an embedded video of the presentation thanks to Mark B… and New Work City. (more…)

Using openFrameworks for iPhone dev

Sunday, May 31st, 2009

[Also available at ITPedia. Watch video of the BarCampNYC4 presentation.]

This is an overview of getting set up using openFrameworks for iPhone development.

What is openFrameworks?

openFrameworks is a “a C++ library for creative coding”. It shares a similar philosophy with Processing (as a library for Java). The intended audience “are folks using computers for creative, artistic expression, and who would like low level access to the data inside of media in order manipulate, analyze or explore.”

There are good resources for reading more about it below, under the Resources heading. This article assumes basic knowledge of programming and of the Xcode development environment. You can simply follow along and launch the demo app, but you should really read the resources to understand the structure of a typical openFrameworks-based application.

Why?

iPhone native application development is typically done in Objective-C. Not pressing the merits and detractions of Obj-C, but it’s *another* language to learn. If you have code / experience working in C++ then you can use oF to migrate those programs to the iPhone somewhat painlessly. Arguably easier to begin working with – espeically if you’re coming from experience with Processing.

Why not?

However, if you already develop in Objective-C, then maybe you don’t need to use oF. OpenFrameworks is not as well documented as Objective-C (even though Apple’s docs are as dense as the proverbial stereo instructions joke). Certain applications are not as suitable (lots of hierarchal views) It’s very easy to overwhelm the iPhone if porting desktop oF code over.

Ultimately, however, this eliminates 90% of Obj-C. Still need to use Obj-C (or Obj-C++) to use iPhone interface widgets. Don’t worry about it right now. (more…)

[my] summer of code

Friday, May 22nd, 2009

iconIn preparation for several iPhone application development gigs which have lined up for the summer I’m getting back into my previous projects. Specifically, I’m going to get Follower and Pinwheel ready for release and am looking to push them out to the AppStore in the next month or so.

Also, as an exercise to get working with a web API I’m building an iPhone native client for SHIFD, called Slide. Right now it’s overly simplistic, but I much prefer the native app to the mobile web app. I’m not sure if I’m going to keep it as a learning project or also invest the time and resources to make it another released application.

All this is in service to building out cloudreader.me, the online version of the CloudReader generative text animation project. I’d like to make that something available sometime.

1-2-10: Cloud Reader interface comps

Monday, April 20th, 2009

cloud-reader-splashThe first web interface wireframes for Cloud Reader. Overall comments: too busy, too complicated for what is supposed to be a simple service. Good advice, back to the sketching. (more…)

openFrameworks + iPhone libs

Wednesday, March 25th, 2009

of_iphoneI’ve had a few days to test the libraries I cobbled together for using openFrameworks with iPhone and also received positive reports from some folks who tried out the Makefiles I provided to them, so here they are for anyone who’s willing to try them out. -please make these instructions better if you see fit- (more…)