28
\$\begingroup\$

I need to port my game project from Android (written in C, OpenGL ES 2.0, thanks to NDK) to Windows and Linux platforms. Of course I will need to rewrite some platform dependent code, but for now I'm stuck with the question of which library to use for creating OpenGL context and handling input.

Just a quick googling gives me 3 candidates:

  1. FreeGLUT - rewritten and free good old GLUT.
  2. SDL - most well know one lib, used in many games.
  3. GLFW - some kind of newer library, but simple and functional.

I'm quite new to PC development and don't see any significant differences between them. Can you help me with the choice? I need only core mouse/keyboard input and creation of OpenGL context. I'll be using GLEW to load OpenGL functions.

\$\endgroup\$
  • 2
    \$\begingroup\$ The answer will be highly opinionated and is not really a good question for the SE format. That said, my highly opinionated answer -- having used all three for real projects, and a few others like SFML, GLUT, Qt, and hand-rolling a solution -- is that SDL gives a good mix of features, stability, and ease of use. I especially recommend the pre-release 2.0 versions (only available by checking out the Mercurial repo and building yourself, but that's quite easy). Second to that, SFML is pretty good. I found too many bugs in GLFW, GLUT is bad for games, and hand-rolling is lots of works. \$\endgroup\$ – Sean Middleditch Jul 19 '12 at 7:35
  • \$\begingroup\$ I personally would recommend SDL because it handles all parts of a game from input to the graphics to the audio and input. However, it can be limiting, but since you're coming from an already developed game for a more limited platform, i think it would be a fine choice. \$\endgroup\$ – CobaltHex Jul 19 '12 at 8:20
  • \$\begingroup\$ Yeah, its a poll. My vote is GLFW, simple, easy, never had any issues that weren't resolved. It is super light weight and easy to compile as well. \$\endgroup\$ – deceleratedcaviar Jul 19 '12 at 8:56
32
\$\begingroup\$

GLFW is modern and has a very well defined scope. It's also under very active development.

SDL on the other side is rock solid and has a lot features in different scopes but is somewhat lacking in all of them (for example: SDL can do audio, but you might prefer using OpenAL because its far superior in that matter). It might be notable that SDL was ported to many different platforms, unlike GLFW which is only for desktop platforms (win/linux/mac).

GLUT, well, should be avoided. There simply isn't really anything about it what makes it good.


In my opinion as perfectionist GLFW is the better choice. Because it does exactly what one wants, nothing less nothing more. The very active development is also a good sign for long term projects because it usually means that bugs will be fixed, that new features will be added, it will keep up with newer standards and that it won't be abadoned anytime near. This isn't important for a quick port or a 6-month game, but for a engine or a library you want to reuse I would keep that in mind.

| improve this answer | |
\$\endgroup\$
  • 8
    \$\begingroup\$ But the OP is asking about Freeglut not GLUT !!! \$\endgroup\$ – user3473 Jan 22 '15 at 10:15
  • \$\begingroup\$ @user3473 "FreeGLUT is an open source alternative to the OpenGL Utility Toolkit (GLUT) library." \$\endgroup\$ – yyny Mar 21 '16 at 18:50
  • \$\begingroup\$ @YoYoYonnY So are GLFW and SDL, hence this question. \$\endgroup\$ – Dan Apr 9 '16 at 4:32
  • 1
    \$\begingroup\$ @Dan... no. GLFW and especially SDL are definitly not alternatives for GLUT, because you can do things with them that you can't with GLUT and vice versa. \$\endgroup\$ – yyny Apr 9 '16 at 11:38
  • \$\begingroup\$ @YoYoYonnY You can do things with FreeGLUT that you can't do with GLUT. My point still stands. \$\endgroup\$ – Dan Apr 9 '16 at 18:17