tags:

views:

843

answers:

6

Trying to decide on a library for creating a window and capturing user input for my OpenGL app, but there are just way too many choices:

GLUT is simply outdated. I liked GLFW but it seems you can't set the window position before displaying it (I wanted it centered, is that so much to ask?) so you see it appear and then shift over, which bothers me. Plus development seems to have stopped on it too. SFML has some nice features, but it uses event polling rather than callbacks which I prefer for decoupling. I don't think I need all the GUI features of FLTK. SDL is slow (doesn't seem to take advantage of the GPU). And the other 3 I don't know much about (FreeGLUT, OpenGLUT, OGLWFW). So which is the lesser of the evils? Are there others I haven't heard about?

I'm just trying to make a simple 2D game. I'm familiar enough with OpenGL that I don't really need drawing routines, but I probably wouldn't complain about other functions that might be useful if they are implemented properly.

+7  A: 

SDL allows you to create an OpenGL context that is accelerated (depending on drivers / hardware support).

I know you tagged as C++, however pygame (python) is a great library for creating 2D games, which also supports an OpenGL context. Pygame is built on SDL.

Clutter is a new OpenGL based GUI library with bindings for Perl, Python, C#, C++, Vala and Ruby. I haven't used it myself. From the website:

Clutter uses OpenGL (and optionally OpenGL ES for use on Mobile and embedded platforms) for rendering but with an API which hides the underlying GL complexity from the developer. The Clutter API is intended to be easy to use, efficient and flexible.

Karl Voigtland
SDL is still C-esque (requires cleanup) and uses event polling rather than callbacks, and doesn't seem to have very good integration with OpenGL (requires the usage of SDL wrapper functions?).
Mark
Once you set up the OpenGL context in pygame or SDL you can use any OpenGL you want. I have an OpenGL app that basically used SDL for windowing and event polling and OpenGL for the graphics.
Karl Voigtland
Well, yeah... I'm not saying it doesn't work, just is going to take a lot more convincing to beat out the other libraries.
Mark
Clutter seems rather confusing.Do you know any open sourced programs that are written in clutter?
the_drow
@the_drow: I think the most high profile open-source user of Clutter right now is the Intel Moblin netbook OS: moblin.org.
Karl Voigtland
+5  A: 

I'd go for Qt. Nice general purpose library + opengl support

gonzo
Right...forgot about Qt. Steep learning curve though, no? Tried using it once before, completely baffled me.
Mark
Hrm... at least the editor it came with was (confusing). NetBeans 6.8 seems to have some level of support for Qt, so getting a simple app up and running wasn't so bad.
Mark
I use Qt with Visual Studio on Windows and Vim/make on *nix boxes. It has really good documentation and clean API. I think there are tutorials for using it with IDEs like Eclipse/NetBeans/etc.. Just google for them
gonzo
Got something simple up and running now... starting to really like it :) Not only does it have perty callbacks... they're magically already registered for me. Seems to force you to separate your code, which is probably a good thing or I'd probably have a big mess already :D
Mark
+6  A: 

GLUT and the other GLUT alternatives should not be used in any sort of production application. They are good for putting together a quick demo application or to try something out, but not for much more than that.

If you're trying to make an OpenGL game, I'd recommend SDL. It focuses more on gaming needs. It most definitely can be used with OpenGL. A brief google for "SDL OpenGL" turned up this link on how to initialize OpenGL with SDL. Enabling OpenGL should also enable hardware rendering with the GPU.

Qt is a reasonable alternative, but it's better if you want to embed OpenGL within a larger, desktop application (think 3D modeling, CAD/CAM, medical visualization, etc) where you need access to standard OS widgets for the UI.

Eric
Yeah... but Qt also seems so much more modern and well designed! My game is going to have an editor... I *can* make use of those extra widgets :p I'll consider SDL for future projects though.
Mark
+1  A: 

Per recent corespondance with the author, development on OGLWFW has stopped.

drknexus
Good to know. They all seem to be dying out... guess you gotta go for a big professionally developed framework these days.
Mark
+1  A: 
IF  "learning c++ part of what you're trying to achieve":
then
IF  "you only want to learn OpenGL with a fullscreen mode":
  USE GLUT //Because it's VERY VERY simple. You can get set up VERY quick
ELSE:
  USE QT //Great library, has many many things that will help you. It is portable, it has a nice API
ENDIF

IF "you don't need C++":
then
   USE Python //I recommend it, it is fast, no long link times, good api, omg I love this language

Background:

I also tried to make simple 2D games once, I started with C++ and NeHe. I knew nothing about OpenGL and C++ (had Java background). The language overrun me, so did OpenGL. So it was a very hard learning curve.

I don't recommend going that way, since you can get faster results by using a dynamic language (such as Python). So I started learning some years later with python. I could get the "rotating cubes" working much faster.

Edison Gustavo Muenz
Well I personally already know both C++ and OpenGL, so that's not really a problem. I just needed a cross-platform windowing API. All the other tidbits were a nice touch on Qt ;)
Mark
+2  A: 

We have had rather good experiences with ClanLib 0.8 in 2008 and ClanLib 2.1 in 2009 on our C++ course. The productivity of the students (as measured by the quality of their project works) has greatly increased since switching over from SDL. However, it needs to be noted that 2.1 is still very incomplete and one will certainly run into features that are simply not implemented yet.

A couple of groups used Irrlicht (3D engine) with good results.

SFML looks promising, but I haven't had a chance to try it yet.

As others have stated, GLUT is not really suitable for anything serious. The rest of the libraries mentioned are something more of GUI toolkits than game development libraries.

Tronic