# What alternatives to GLUT exist?

I am trying to learn OpenGL, and I just found out that GLUT is obsolete. I already know SDL, and it seems it is a good alternative. Should I use SDL to develop games with OpenGL, or are there any better alternatives. I am new to game development, so I don't know much about the state of the art.

I just found out that GLUT is obsolete.

That's what happens when you accept the first answer you come across; you get bad information. GLUT 3.7 shouldn't be used, but FreeGLUT is completely backwards compatible with it.

However, your question goes elsewhere. For making an actual game, GLUT of * form is inappropriate. It doesn't give you control of the main loop, and you really need that in a game (FreeGLUT does have a way to control the main loop, but it's still odd). GLUT is for writing graphics demos. That's very important when testing new graphical effects, so it should be there in your toolbox when needed. But your main game code should never use it.

GLFW is a game-centric lightweight alternative to GLUT. It provides basic support for things beyond creating an OpenGL window. It lets you get input, load images as textures, and a couple of other things.

SDL, SFML, and Allegro 5 are all multimedia toolkits. They can create OpenGL windows, but they do a lot more than that. They provide full support for input, audio, and various other stuff you need to make a game. If you're making a game, any of these are a good starting point. I personally like Allegro 5, but that's just my bias towards good documentation and a clean API.

• What does the AAA titles(both pc only and multi-platform) uses? Do they use these(GLFW, Allegro) that you've mentioned, for handling opengl window? or they write their own 'everything' from the scratch? – Quazi Irfan Feb 10 '12 at 17:45
• @iamcreasy: "AAA titles" (I really hate that term) don't use any of these. In general, they don't use anything open-source. They could, but if they're going to use a library, they'd much rather use a library that is supported. There are some exceptions like ODL or Bullet. But those are exceptions rather than the rule. – Nicol Bolas Feb 10 '12 at 17:55
• Since when does GLFW 'load images as textures'? Definitely isn't in the feature list; nor any functions that remotely serve that purpose in my glfw header. – deceleratedcaviar Feb 10 '12 at 18:05
• The other big downside to GLUT is that its input model isn't particularly well-suited to games; there's no way to get raw keycodes or to get press/release events on the modifier keys themselves (e.g. using ctrl as a fire button), nor is there a way to get the underlying GL context (which is necessary to enable vsync on X11, for example). – fluffy Feb 10 '12 at 18:56
• @NicolBolas ah, I forgot about 2.7, they [threads, images] have been declared 'out of context' for the GLFW 3.0 release. – deceleratedcaviar Feb 10 '12 at 21:38

http://www.opengl.org/resources/libraries/windowtoolkits/

To that i would also add SFML:

http://www.sfml-dev.org/index.php

### If your goal is to develop a game,

It depends on whether you want your game to be cross-platform or not. For portable (Windows, Mac, Linux) games SDL seems to be the only choice.

If you only target Windows and/or XBox, there are much better alternatives, e. g. XNA which frees you from writing a lot of code manually.

### If your goal is to learn OpenGL,

Just program in raw OpenGL, but be prepared to face a lot of unintuitive concepts, math and huge manuals.

• As Takumi said, there's also SFML as a portable library. Better than SDL imho (it's more up-to-date.) – kaoD Feb 10 '12 at 15:26
• -1: "For portable (Windows, Mac, Linux) games SDL seems to be the only choice." This is not even remotely true. SFML and Allegro 5 both exist as perfectly valid alternatives, and both have wider platform bases. – Nicol Bolas Feb 10 '12 at 16:22

GLUT is an API as well as a library. The original library is indeed obsolete. The API is a different thing, it was pretty good to begin, it just needs revisions for overcoming limitations and addressing new needs. The primary current implementation is FreeGLUT, which is supported and not obsolete. That means that a good alternative to GLUT (as in the library GLUT) is GLUT (as in FreeGLUT).

The problem noted above with "control of the main loop" is incorrect. With newer GLUT versions you can have better control over your game loop (if that is important to you). The limitation was fixed by glutMainLoopEvent(). This and other limitations are addressed here:

http://en.wikipedia.org/wiki/OpenGL_Utility_Toolkit

• "With newer GLUT versions you can have better control over your game loop (if that is important to you)." It's a game, so yes, that's important to you. Also, glutMainLoopEvent is hardly a good way to go about managing the main loop. It still uses an event-driven model for feeding you data, rather than a polling model where you get the data you want when you want it. – Nicol Bolas Apr 1 '13 at 10:39
• I must argue that the event driven model is more efficient than polling, unless you are polling into data stored from the events (which is just fine). Polling system resources should be done carefully. – Ingemar Ragnemalm Jul 30 '17 at 12:58

Qt does support OpenGL. Take a look to Open Inventor and consider if make it sense for you to go straight to an higher level 3D API.