I got my starfield going last night.

Here’s a link to the YouTube video.


iPhone OpenGL Developin’

I got a good session in last night, doing some plumbing code for OpenGL games. My need for OpenGL is modest here. Basically I just want to be able to use it as a 2D API to render rectangular areas with images.

So I came up with a few simple objects to help me: VertexSquare, ColorSquare, TextureSquare.  These encapsulate an array of values that need to be used in order to render a simple rectangle.  These give me, respectively, the vertices, colors, and texture coordinates of the rectangle.

I have already set up a matrix to pretend that the upper left of the screen is (0,0) and the lower right is (40,25).  This way I can use a grid of VertexSquares (actually, there is an object called VertexGrid for this purpose), and I can split up a texture into a bunch of TextureSquares (called a TextureGrid) in order to make a tileset.

I also encapsulate a VertexSquare, a ColorSquare, and a TextureSquare, in conjunction with a Texture object (that actually wraps a real texture) into something called a RenderSquare.

A lot of this exercise is to give myself those classes that I know will be useful in hammering out games.  Pretty much any language and platform I’m on needs a set of things like these in order to make work go faster. I don’t want to have to put together texture coordinates and vertices and color arrays. I want to have an object to point to and say: use this texture, this part of the texture, this color, and at these coordinates, and render.

I’m also getting re-used to the retain/release memory management stuff in Objective-C. I stuff a series of TextureSquares into an NSMutableArray in order to create a TextureGrid.  I always make mistakes initially until I’m reused to these things.


Additional Mac Woes

So, I reinstalled OSX. It took hours, as the installer kept having some sort of error somewhere in theinstaller. I disabled everything except for the absolutely required items, and it finally worked!

And then I went to download the iPhone SDK!

And then I found out that I need Snow Leopard, and I only have the non-Snowy Leopard!

Yesterday, Best Buy was closed (and I’m not interested in paying $4 for shipping), so I have to go and buy a new cat today, because my cat is no longer good.

In the meantime, I started putting together the software I wanted on the mac. I put in pixen, openoffice, xcode, qt, haxe, and scratch.

And yesterday evening, I spent some time trying to reacquaint myself with Cocoa and Interface Builder. I managed to wire up some buttons and textboxes.  I was able to nurse the ailing and little used IBOutlet neurons back to health.

I ended the evening trying to work with an NSOpenGLView. I found a set of tutorials to follow.