Thursday, December 11, 2008

An OpenGL Project Template for Xcode

I'm not a fan of the OpenGL ES Application project template that ships with the iPhone SDK. It's a pain in the ass to go in and delete the drawing code and futz with the timer, and find where they did the setup, etc. For my purposes, a much simpler template with just the skeleton of the application - a template that has places for setup and drawing code, but that doesn't give me any, is what I want.

So, I wrote one. It's been a few years since I wrote a project template - was a lot of trial and error to make sure everything worked nicely. Hopefully, I can save some people from going through the same effort: You can download the project template here.

To use it, unzip the archive and then drag the resulting folder to the following location (you may need administrator privileges to do this):
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application/Window-Based Application
I believe that there's a way to put the template under ~/Library/ somewhere, but I don't honestly know where to put it there and have it show up in the right place (as an iPhone template rather than as a Mac project template).

When you want to create a new OpenGL project, just select "Empty OpenGL Application" from the templates. This template is modeled after the GLGravity project, so it uses no nib file, and has two methods in the App Delegate for doing the initial setup of the OpenGL ES context, and then another one that gets called to do the actual drawing. The drawing frequency is controlled by a constant that is set to 60.0, but can be changed to whatever is appropriate.

Does anybody know how to assign an icon and description to a project template?

Over the next few days, I'm going to take some of the wonderful NeHe OpenGL Tutorials and port them to the iPhone and OpenGL ES. There aren't enough good, clear examples of using OpenGL ES on the iPhone, and I thought porting these might help some people (not to mention helping me get my head back into OpenGL after being away from 3D programming for quite some time).



5 comments:

Bibhas said...

g8!

jazzmic said...

That would be great! I'm following this blog with increasing interest :). Thank you!

ChriB said...

To change the icon and description just right-click on the Xcode Project file and choose "Show Package Contents".
Delete the files that are named like your user account (these files just include the view settings you've done to this project) so you have a .pbxproj, a .icns and a .plist file.
the .plist holds the description, if you want a line break in it just put one in (took ages for me to figure it out by using the Plist-Editor because you can't see the text in the non-multiline-textfield).

Marco said...

Thank you!! ;-D

h4ns said...

What youre saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. I also love the images you put in here. They fit so well with what youre trying to say. Im sure youll reach so many people with what youve got to say.

Arsenal vs Huddersfield Town live streaming
Arsenal vs Huddersfield Town live streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Notts County vs Manchester City Live Streaming
Notts County vs Manchester City Live Streaming
Bologna vs AS Roma Live Streaming
Bologna vs AS Roma Live Streaming
Juventus vs Udinese Live Streaming
Juventus vs Udinese Live Streaming
Napoli vs Sampdoria Live Streaming
Napoli vs Sampdoria Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
AS Monaco vs Marseille Live Streaming
AS Monaco vs Marseille Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Technology News | News Today | Live Streaming TV Channels