Which Of These 3 API Combinations Would You Advise (GUI's)?

Started by
5 comments, last by MrJoshL 10 years, 8 months ago

I am writing a game editor in C, and these are my 3 choices I see right now, along with my reasoning. Which of these would you advise, and why?

1. OpenGL + X (I'm already using OpenGL for the rendering, I already know a small bit of X programming)

2. OpenGL + SDL (SDL is more abstracted and cross platform than X, but I have never used it)

3. GTK+ (It is written in C like my program, but uses more resources and I have never used it)

I was kind of leaning towards option 1 because my logic is that in the time it takes to learn a whole new API, I could have written a small GUI system in OpenGL and X that fulfills all of my specific needs (correct me if I am wrong) and is lighter weight.

My Questions:

1. Which way would you do it?

2. Why would you do it that way?

3. How long do you think it would take YOU to do it your way?

4. How long do you think it would take YOU to do it the first way?

I very much appreciate your answers, if you have any.

C dominates the world of linear procedural computing, which won't advance. The future lies in MASSIVE parallelism.

Advertisement

I can't comment on X or GTK+, but I can comment on SDL. SDL is a lightweight wrapper around basic keyboard/mouse/gamepad input and graphical windows. Unless things changed with SDL 2.0, SDL doesn't have any GUI system. You can ofcourse use it in addition to a GUI system, but it doesn't come with GUI features out-of-the-box.

1. OpenGL + X (I'm already using OpenGL for the rendering, I already know a small bit of X programming)

2. OpenGL + SDL (SDL is more abstracted and cross platform than X, but I have never used it)

3. GTK+ (It is written in C like my program, but uses more resources and I have never used it)

1. OGL + X11 = too much nope... detecting all the extensions, handling all the corner cases, doing backflips and handstands to use 1980s tech to do a 1990s job, no thanks. Just choosing the right visual and obtaining the correct GLX context is painful, let alone event processing. There's a reason why all those toolkits evolved to wrap X11 and make it entirely disappear from the API. Very large learning curve, poor documentation, difficult to debug.

2. OGL + SDL = good choice. Small learning curve, good documentation. Sometimes a pain to debug.

3. GTK+ = run, don't walk away -- a massive, massive, heavyweight API in which you have to rewrite the C++ runtime in every source file, and with no upstream support (maintenance is not considered a community activity, reinventing the entire API every couple of years is where it's at).

Very large learning curve, poor documentation, difficult to debug.

And yes, I've used all of the above.

Stephen M. Webb
Professional Free Software Developer

Another option you might want to look at is Tk, which has C bindings and does have a more or less complete set of GUI widgets.

I would take a look at Qt

I would take a look at Qt

Qt is C++, not C. I started to suggest that myself, actually - I like Qt. smile.png

I think I will follow Bregma's advice and just use OGL + SDL. That way I can make a version for Windows, Mac, and Linux without learning the intricacies of Win32, Cocoa, and Xlib. Thank you to all of you for your advice.

C dominates the world of linear procedural computing, which won't advance. The future lies in MASSIVE parallelism.

This topic is closed to new replies.

Advertisement