Need advice on picking a window toolkit

Hi,

I am curently starting to develop a small 2d game engine in C++ using the 2d functionality that OpenGL provides. I however cannot decide what window toolkit to use for my game engine.

I am making the game engine for two reasons: because I want to make 2d games, and because I want to learn from it. Because I also use it as a learning experience, I don’t want to work with too high-level libraries. I want to have as much control over everything as possible, and do research on the best methods to implement something etc., because I learn more that way. I also hate to find out that the library I’m using doesn’t support a certain feature that I would have been able to code myself if I would have used lower level libs.

So, I am asking for advice on which library to use for creating and modifying OpenGL windows. GLUT, freeGLUT, SDL (tried that but didn’t like it, too many restrictions and too many things I don’t need that cause overhead), or perhaps just xlib and mfc? My game engine does HAVE to be usable to create games for both windows and linux (X11), and preferably also for Mac, although this is a lower priority. I want the library to be able to do things like set the window icon, change the width and height of an already created window with code, and not just respond to resize events (is this even possible?), create a borderless window, create a window of a particular shape, move the window around the screen with code, etc.

What is a good library that gives me lots of options? Do I have to use xlib and mfc on windows to accomplish these things? I don’t mind if I do, but I would like to know if using these isn’t overkill and too much work.

Hi,
I recommend GLFW. It does not have all functionality you want but it is very simple yet powerful. Remember that you have access to the source code so you can add desired features.
In my experience using win api and xlib is a lot of work. I recommend focusing on your game and using existing code.

Thanks for the reply!
I quickly glanced over the reference manual and saw a lot of promising things. At first glance it also looks like something not too hard to extend with my own code if I should have the need, as opposed to SDL which I did not find very logical. But that is only my personal opinion, of course.

Anyways, thanks for the tip! I think I’ll give it a try.

Well, seems that glfw lacks a lot of features that I want after all. I’m on Ubuntu linux, and the window resize, iconify and restore functions do not work, I can’t set the window icon on linux, and glfw does not provide functionality to create a window without decorations, to create a window with a particular, non-rectangular shape, to switch between full-screen and windowed mode after the window is created, and so on…

Can anyone recommend another library that does have these features? Otherwise I guess I have no choice but to look into xlib and win api. Why are all those libs so limiting? If they could just return some kind of window handle so that the user could do other things with the window if he desires…

Also, what exactly is different from an OpenGL window than lets say a GTK+ application window? Can’t you just create an OpenGL context inside a GTK+ app? I’ve seen some kind of extension for GTK+ that tries to realize this but I’ve heard it breaks a lot of OpenGL functionality. Why is this so hard to do? I just don’t get the difference between those window ‘types’.

Qt4 has pretty good OpenGL support.

Why are all those libs so limiting?

Because your needs are very specific ?

“and the window resize, iconify and restore functions do not work, I can’t set the window icon on linux, and glfw does not provide functionality to create a window without decorations”

these are quite some requests. All of these things are OS-specfic, so you would need a cross-platform GUI toolkit. GLUT is normally my choice if I want to make a simple prototype, both in linux, OSX and win32. for more advanced or involved stuff, check out Qt, but I think your focus is a bit off. Do you want to explore windows/widget programming, or OpenGL programming. If the latter, GLUT would be my recommendation, because it’s also quite easy to hack into if you insist on having the features you want.

J