View Full Version : Multi platform graphics
Dru Lee Parsec
11-20-2002, 07:48 PM
OK, let's say that there is this hypothetical Java guru who has been thinking about how he hasn't used his C/C++ skills in years and he wants to do a little programming assignment for himself just for fun.
Now let's say he wants to code it up in Linux but also run it on Windows. And, let's say he wants to have some graphics in his program (which is GUI based). How would he go about it?
What's this GTK stuff I've heard people talk about? Where can I learn about it and is it, in fact, based on C?
Thanks folks.
Strike
11-20-2002, 08:18 PM
GTK homepage - www.gtk.org
GTK is the GIMP ToolKit. The people who wrote the GIMP (http://www.gimp.org) wanted to create a more feature-rich widget to go along with the GNOME environment (since the QT widget set was not GPL'ed at the time). So, GTK was what came out of that.
Yes, it's based in C, but there are bindings for many languages. You can do with it ... well, it's probably best to think of the GTK programs out there, and what they have done. The GIMP is an obvious example, several others are: Galeon, X-Chat, Evolution, all of the GNOME stuff, Pan, Gaim, Gabber, etc. Those are all GTK programs (many are in fact, GNOME programs as well, using GNOME libs as well as the GTK libs).
Strike
11-20-2002, 08:20 PM
Actually, here - http://strike.homelinux.org/~ddipaolo/screenshots/gnome-ss3.png - this screenshot contains nothing but GNOME and GTK apps. There's what you can do with GTK :)
bwkaz
11-20-2002, 08:42 PM
gvim and alsaplayer both default to a gtk widget set. I'm pretty sure Mozilla does as well.
sans-hubris
11-20-2002, 10:19 PM
Hmm, I don't much like using GTK as a cross-platform GUI library. On Windows, it still looks like GTK, not a native Windows application (e.g. The GIMP (http://www.gimp.org/~tml/gimp/win32/).)
However, it is written in plain old C. I know of no other cross-platform GUI libraries that are written in just C.
One of my favorite cross-platform libraries, though, is a C++ library called wxWindows (http://www.wxwindows.org). It looks native on Windows and MacOS (it somewhat works under X, but I've heard it's a little buggier than the rest of the ports), and it uses GTK or Motif for UNIX. However, GTK applications don't look that nice under KDE, and the project to port it to KDE/Qt seems to have been dropped.
Speaking of Qt, I do like that library as well. It does have C bindings now, but those, for all intents and purposes, only run on UNIX (they were built on top of the GPL'ed version of Qt, I have no idea how well they would work on top of the non-free Windows versions, but it might, and it wouldn't hurt to try.) While it's not C++, but rather tricks with the preprocessor, I do find the SIGNAL/SLOTs system to be somewhat ingenius and intuitive. A lot of people find fault with it, but it makes a lot of sense when you actually sit down and code with it.
Dru Lee Parsec
11-21-2002, 12:46 AM
Sans-hubris:
Do I understand correctly that the Unix/GTK+ version is what I would download for Linux?
Dru: if you're not looking for a gui/widget app, you can use OpenGL/Glut.. it's pretty easy to get the hang of for basic stuff, and it's cross platform. oh, and it's cool.
Strike
11-21-2002, 01:07 AM
Originally posted by Dru Lee Parsec
Sans-hubris:
Do I understand correctly that the Unix/GTK+ version is what I would download for Linux?
Just grab whatever packages exist for your distribution (name it, and we can help).
sans-hubris
11-21-2002, 04:08 AM
Originally posted by kmj
Dru: if you're not looking for a gui/widget app, you can use OpenGL/Glut.. it's pretty easy to get the hang of for basic stuff, and it's cross platform. oh, and it's cool. GLUT is a pretty cool, though rather limited, GUI library. It's not difficult to program with either (although, OpenGL in general is a very well made graphics library, unlike Direct3D, which seems rather convoluted and overly complex for its purposes.)
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.