Posts Tagged ‘openframeworks’

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?

(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…)

counting change

Thursday, March 26th, 2009

ofcountingchange

As an in-class exercise for Spatial Media we were asked to develop a program which would identify coins in a series of supplied images and tally up their total value. In one hour.

Since time was limited, I decided to use pixel count as a rough estimate of each coin’s size. This works very reliably with the sample set of images, but that’s likely because the images consist of duplicated coins and are on a solid white background. Several additional methods wold likely need to be implemented to deal with actual situations. (Code below) (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…)

openFrameworks + iPhone

Monday, March 16th, 2009

particles-iphoneI’ve heard about openFrameworks 0.6 (as of yet unreleased) and specifically efforts to support building apps using oF for the iPhone. There are a few developers who have published videos of their efforts and even several apps in the AppStore.

Memo Atken has a very informative article about setting up the prerelease 0.6 version for use with the ofxiPhone addon. However, there is a HUGE simplification of the steps necessary for getting the supporting libraries installed for use with iPhone.

Update: freetype/freeimage building instructions have been posted. (more…)

TrafficFlow: Prototype

Friday, March 13th, 2009

flow-darkAmeya and I presented the prototype of TrafficFlow yesterday at ITP for our Spatial Media midterm project. It is an installation-based table which visualizes wireless traffic on a local network as gracefully flowing rivers of light.

Each user on a network has an individual connection to the internet and may have a conceptual model of personalized “tube”. However, all traffic on a typical network shares the same infrastructure and commingles at some point, and if unencrypted, is available to any other member of the network. TrafficFlow aims to make visible this hidden connection. (more…)