GLUT or Cocoa?

I am aspiring Mac game programmer. I would like to use OpenGL, but I am undecided whether to use the relatively simple GLUT interface, or to use the Cocoa/OpenGL interface. It seems like Cocoa would have a lot of overhead, and I'm not sure what the advantages of using that interface would be over GLUT.

Thanks

MacBook Pro, Mac OS X (10.4.7)

Posted on Jul 25, 2006 8:26 AM

Reply
3 replies

Jul 25, 2006 12:45 PM in response to crmartin

There are two questions you have to answer to decide the framework that is best for you.

1. Do you eventually want to learn to write GUI applications as well as games?
2. Do you want your games to run on Windows and Linux as well as Mac OS X?

Cocoa's main advantage is you can write GUI applications quickly. Cocoa would be a good choice to write a level editor for your game if your game needs one. If all you care about is writing games, there is not much advantage to using Cocoa.

If you want your games to run on Windows, Linux, and Mac OS X, I would recommend using SDL, which is a game library that does everything GLUT does and more. What is nice about SDL is it has supplemental cross-platform libraries for loading images (makes OpenGL texture loading easy), playing sound, and networking. SDL can also work with OpenGL if you want so you can use OpenGL for your graphics and SDL for things like reading input from the player.

The SDL website is located at the following URL:

http://www.libsdl.org

If you go to the Tutorials section, you will find a link to an article I wrote that shows you how to use SDL with OpenGL on Mac OS X.

Mac OS X (10.4)

Jul 27, 2006 4:37 PM in response to crmartin

I think cross-platform (SDL) is the way to go. Although I will be concentrating on Mac OS X, there's no reason to limit myself.

I guess the next question would be what language to use. I suppose C/C++ is the cross-platform choice, but I really would prefer something more developer friendly (esp. in terms of memory management). ObjC is the natural choice for Mac OS X, but I'm not sure how well it is supported on other platforms. I'm familiar with Java and Python as well, but I'm not sure about the performance of those for games.

I would love to hear others opinions' on language as well.

Thanks

Jul 28, 2006 12:46 PM in response to crmartin

Since you know Java and Python, go with one of them to write your game. SDL has bindings for both languages. You can see all the languages SDL supports by clicking the Languages link at the SDL site.

Don't worry about performance right now. Your first game should be a simple 2D game, such as a Tetris clone, Breakout clone, or shooter (think Asteroids, Space Invaders, or Galaga). Java and Python are fast enough for simple 2D games. When you're ready to move on to more complicated games that require maximum performance, you can switch to C or C++.

Mac OS X (10.4)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

GLUT or Cocoa?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.