Archive for the ‘iPhone’ Category

Retrospection of the iPhone Developer Conference 2009

Monday, December 7th, 2009

The German iPhone Developer Conference in Cologne (01-02 December) was an exciting event that started with a very informative keynote by Maximilian Reiß who elaborated the tide of iPhone events of the last years. From there, nearly 200 attendees were invited to join business-related presentations and developer-oriented talks on separated tracks over the next two days.

Nearly 200 attendees, 29 talks on 2 days and 3 winners of the best German iPhone App contest at the iPhone Developer Conference

Nearly 200 attendees, 29 talks on 2 days and 3 winners of the best German iPhone App contest at the iPhone Developer Conference in Cologne

I had the chance to introduce the iPhonical project that applies model-driven techniques to produce parts of iPhone applications automatically. The presentation first describes a way to separate generated code from manually written source with the Objective-C concept of categories. From there, I demonstrated that even with powerful frameworks such as ObjectiveResource (an adapter to connect iPhone apps with Rails applications) one can benefit from code generation. With the help of the iPhonical DSL (implemented with Xtext) keeping data-centric classes in sync with the web application was way easier than coding them by hand.

The iPhoneDevCon was a very informative event. Many passionated developers or leads, growing studios and enthusiastic marketing representatives shared their ideas and during the breaks you could easily discuss different viewpoints of today’s opportunities and approaches.

Apart from the 3 winners of the “best German iPhone app” (according to iPhone & Co) a brand-new iPhone and Mac magazine, mac-developer, has been announced. As the name suggests it concentrates on developers and its first issue is quite promissing.

Links

iPhonical at the second German iPhone Developer Conference in December 2009

Sunday, October 25th, 2009

This December will start with two exciting days when the German iPhone Developer Conference takes place in Cologne. With 28 talks about business and engineering on two tracks the second iPhoneDevCon celebrates the second anniversary of the iPhone itself. Not by accident Maximilian Reiß picks up this coincidence and gives a résumé of two eventful years with apple’s successful device in his keynote.

My talk about model-driven iPhone development in general and the open source tool iPhonical in particular ranks among many other promising talks for developers.

Visit the iPhoneDevCon in Cologne on December 01-02, 2009

Visit the German iPhoneDevCon in Cologne on December 01-02, 2009

If you are planning to attend please contact me in advance. Being a speaker I can give away a limited amount of promotion codes. This might safe you some expenses and allows you to buy me a drink in return ;)

Burlington Ducky iPhone App

Friday, October 2nd, 2009

The people at itemis provide a vast range of skills beyond model-driven engineering. For me, this versatility yielded an iPhone project in cooperation with Weischer Mobile and phi mobile media where a funny marketing app had to be delivered. The design concept presented to Burlington drafted a line (water), a circle (duck) inside a rectangle (iPhone) and an arrow (movement). Some bullet points completed the requirements of the part I was asked to implement. Even though the final app offers some more features such as a movie, funny photo tricks and wallpapers, I was responsible for the ducky only. This is what I came up with:

Under the hood, the animated ducky as well as the illusion of water is based on a hand-crafted physics engine. The water is implemented as a particle-based fluid simulation. Matthias Müller published a paper with the same title and great slides for SIGGRAPH 2007 as a starting point if you are interested in this topic. The ducky itself interacts as rigid body with these particles where buoyancy had been implemented explicitly. Play with Erik Neumann’s demo to have fun with rigid body physics. These concepts had been adjusted and combined with the accelerometer and touch sensors built into the iPhone to let the user interact with the simulation.

Different techniques had been applied to realize the illusion of a ducky swimming in water

Different techniques had been applied to realize the illusion of a splashing ducky

Having just dots and circles as one could look at the physics engine was obviously not the ultimate goal. From the raw data of the simulation the water surface area had to be derived, the ducky had to be put in shape and some smooth animations and sounds were needed to round out the illusion of an interactive bathtub.

Without going into every detail I want to emphasize that the iPhone is not a MacBook Pro. Where you traditionally use marching cubes/squares to convert distinct particles into a cohesive area the processing power of mobile devices requires you to squeeze out every cycle by thinking outside the box and taking advantage of hardware acceleration. In this case, OpenGL ES offers a variety of techniques including framebuffers, blending functions and alpha tests to perform the needed steps by the GPU.

metaball technique from particles using blending and alpha functions

metaball technique from particles using blending and alpha functions

Some other findings during the project include the unreliability of sensor data as well as users’ unpredictable behavior. Be aware that humans and machines act differently under certain circumstances. For applications where the interaction between those both is crucial you should do usability tests early, often and extensively before delivery, again.

The iPhone is different from other mobile devices or the emulator. Generally, floating point arithmetic will be evaluated more efficient than fixed-point. Some GPU operations are executed faster on the device than on the emulator, others are of poor performance though. Therefore, you should profile on the device to test different approaches of your design regularly. And: You must not forget to do so with sound enabled since sound processing might take more than 30% of your overall processing power.

So, go ahead and grab your version of the Burlington Duck on the app store:

If you are interested in details (e.g. “unpredictable human factor”, production of the screencast, etc.), please let me know and use the comment function of this post.

obj2opengl: convert obj 3D models to arrays compatible with iPhone OpenGL ES

Thursday, August 27th, 2009

Whenever you want to use 3D objects modeled with a software such as Blender, 3ds Max or Cinema 4D in your iPhone Application or any other OpenGL project, you somehow have to make the designed data accessible to you program. To do this you can either load and interpret the files your models are saved into or you could directly provide the needed in-memory representation your program expects.

OBJ2OPENGL does the latter and acts as a converter from model files to C/C++ headers that describe vertices of the faces, normals and texture coordinates as simple arrays of floats.

Texturized and lighted 3D model with 8056 faces on the iPhone

Texturized and lighted 3D model with 8,056 faces on the iPhone

OBJ2OPENGL is a Perl script that reads a Wavefront OBJ file describing a 3D object and writes a C/C++ include file describing the object in a form suitable for use with OpenGL ES. It is compatible with Objective C and the libraries of the iPhone SDK.

The original idea and code base of this script comes from Margaret Geroch who kindly allowed me to enhance and republish this version. It now supports texture mapping and stored normals (instead of recalculating them). I have changed the structure of the generated arrays to work with glDrawArrays instead of glDrawElements. This is particularly needed for normals and textures where a vertex holds different information for some shapes. Also, this version includes several command line options to better control its behavior (such as scaling and moving the origin or setting the object’s and output file’s name).

If you can go with the defaults the conversion is as simple as

./obj2opengl.pl banana.obj

To include the converted object all you have to do is

// include generated arrays
#import "banana.h"

// set input data to arrays
glVertexPointer(3, GL_FLOAT, 0, bananaVerts);
glNormalPointer(GL_FLOAT, 0, bananaNormals);
glTexCoordPointer(2, GL_FLOAT, 0, bananaTexCoords);

// draw data
glDrawArrays(GL_TRIANGLES, 0, bananaNumVerts);

Examples

These are two models and generated sample output that is included in the provided archive:

Input Output Texture Vertices Faces
cube.obj cube.h 8 6
banana.obj banana.h banana.jpg 4,032 8,056

Downloads

Please use the comment function of this post to discuss any problems or noteworthy results accomplished with help of this script. I will read feature requests, too. Feedback is highly appreciated.