Posts

Showing posts from February, 2010

Cloth Simulated on iPhone

Image
I have always wanted to make a cloth simulation program. The idea of a grid of points controlled by a bunch of springs just seems so simple to implement with such interesting results. Thanks to people much smarter than me, like Thomas Jakobsen , there is a de facto algorithm for it and plenty of tutorials. I've pretty much completed the graphics part of this exercise, which means I have a variable grid that I can draw... now I just need to put in all those equations and algorithms to make it move around. Here's a screenshot of the progress. One interesting thing in this picture are the colored parts of the grid. I allocate an array for the vertex colors but have not yet initialized it, so its just random data. The colors change a little when I make touch events. Update: Cloth is pretty much finished now, more pictures and a short video on flickr.

OpenGL ES - Procedurally Generated Cylinder

Image
I'm just getting started with OpenGL on the iPhone and the first object I need is a cylinder. I created a small C++ program to generate the structures needed. The resulting cylinder looks like this: Here is the code:

Xcode 3.2.1, Interface Builder and Outlets

First day of iPhone development and I've already hit a problem.  Using the Stanford iPhone Application Development course as a crash course the first lecture had a demo application  using a program called "Interface Builder" to hook together a bunch of pieces for a basic UI.  Well the most important part, hooking the pieces together, changed with version 3.2.  Rather than creating the outlets from the interface they must be added explicitly to the header file. For completeness, here is the code which needs to be added (it was difficult to read from the video) MyConenctor.h @interface MyController : NSObject { IBOutlet UILabel *label; IBOutlet UISlider *slider; } -(IBAction)changeLabelText:(id)sender; MyConnector.m -(IBAction)changeLabelText:(id)sender{ int value = slider.value; label.text = [NSString stringWithFormat: @"%d", value]; }