OpenGL Bullfrog

Finally had some time today to toy around with some OpenGL programming. One of the first architectural changes we’re going to tackle in Bullfrog 2 is to move all the graphics engine code to use OpenGL instead of Cocoa.

I created a new Xcode project to house our experimental code while we find our way around OpenGL. After hacking away for a couple of hours I was able to get a basic though flawed proof of concept to render our old friend from the first Bullfrog game into a custom NSOpenGLView.

I haven’t figured out how to get transparency to work with the alpha channel and the sprite is sized too small, but not too bad for a first go.

After some more reading I should be able to figure out how to fix the frog’s size and transparency issues.

I did encounter an interesting “bug” while putting together the UI in InterfaceBuilder. Using an NSOpenGLView directly with a custom class will never call your -initWithFrame: method. The only way I could find to get the method invoked was to use a Custom View (NSView) instead of the NSOpenGLView and then use my same custom class. Perhaps I’m just missing something, but this seemed strange.



, , ,