Announcement: Be excellent to each other.


Caravel Forum : Other Boards : Anything : WinXP C++ compiler and graphics library (Which ones should I get?)
New Topic New Poll Post Reply
Poster Message
Beef Row
Level: Smiter
Rank Points: 471
Registered: 12-28-2005
IP: Logged
icon WinXP C++ compiler and graphics library (0)  
OK... so I learned C++ back in high school but its been about 5 or 6 years now. Back then I used DJGPP (by preference), and some Borland junk the school forced on me.

Now, I've just officially declared a computer science major, and I'm comfortable in Java, but not C++. I need to relearn C++, since all the classes at my school are taught in it.

So, which free (preferably open source) compiler is currently a best choice on Windows XP? It should be one compatible with a free, relatively easy to learn, open source graphics library (which I'd also appreciate recommendations for).

As far as the graphics library, maybe the library DROD uses, so I can go back and look at its source later, once I have a feel for the language again. But mainly I want the graphics for things like fractal display, graphs, etc, so if something else is more suited to graphics created as needed, as opposed to opening existing media, I'd prefer a library that aims at created graphics as opposed to outside resources.

Thanks for any advice!

____________________________
"Now I will repeatedly apply the happy-face rule"
05-21-2006 at 08:35 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
asmussen
Level: Master Delver
Rank Points: 188
Registered: 04-02-2004
IP: Logged
icon Re: WinXP C++ compiler and graphics library (+1)  
Well, since you say you've used djgpp in the past, you could always use that again. The current version works with XP.

http://clio.rice.edu/djgpp/win2k/main.htm

Since that is based on gcc, you might also give cygwin a try. That's much more than just a compiler, but under the cygwin environment, gcc runs pretty much without modification. The version of gcc that currently comes with cygwin is 3 point something, I believe. Cygwin also comes with several graphics libraries including gd,gtk,imlib,ImageMagick/GraphicsMagick,etc... Also, many open source graphics libraries such as libsdl can be compiled under the cygwin environment. Cygwin is especially useful if you are proficient in a Linux/UNIX environment.

http://www.cygwin.com/
http://www.libsdl.org/index.php



____________________________
Shawn Asmussen
05-21-2006 at 09:28 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
trick
Level: Legendary Smitemaster
Rank Points: 2580
Registered: 04-12-2003
IP: Logged
icon Re: WinXP C++ compiler and graphics library (+2)  
Well, DJGPP is a DOS compiler, so for native Windows C/C++ you'd be better off with mingw (stands for "Minimalist GNU for Windows" or somesuch. It's a gcc port that use native Windows runtime dlls so your programs can run without any of that extra cygwin fluff). Mingw is part of cygwin, but I think you have to give a switch to the compiler to enable mingw mode (-mwindows or -mno-cygwin or somesuch .. check the docs). At least you had to do that before, but it's been a while since I used cygwin.

Cygwin doesn't come with an IDE. If you want that, some people seem to like Dev-C++ (I've never used it myself, though). It includes a mingw compiler.

As for graphics library, that depends on what kind of graphics you want. I'm a fan of SDL myself (it's also what DROD uses), but that's more suited to games than anything else. It's very simple, all it does is give you one window* and surfaces you can blit to each other, and draw on manually. This is great for games, but maybe not so great for other things. (SDL also handles input, sound, threads, and other things that are nice to have in games). It doesn't provide any font drawing either, so if you want to write stuff to the screen you'll either need to make your own font drawing routines (bitmap fonts are pretty easy), or use something like SDL_ttf (DROD uses this). Also, there is an (unofficial) add-on library to SDL called SDL_gfx that provides functions for drawing graphics primitives like lines and circles and such, but I've never used it myself (I'm the kind of guy who likes to make his own line and circle drawing routines), so I can't say if it's any good.

Allegro is another library. Like SDL, it's primarily used for games, but unlike SDL, it provides a whole lot more than just the bare minimum. It's got functions for drawing lines, circles, polygons, fonts, etc .. It's even got a (basic) GUI. It also has a DOS port :) (Allegro's been around a long time. My first graphical C program on the PC used this, in DOS.)

wxWidgets is a GUI library, not so well suited for games but nice if you want a window w/menus, buttons, checkboxes, etc. I don't know if it has any graphic primitive drawing routines, though, as I haven't used this myself. (Yes, I keep recommending things I haven't used. I'm sure a mob will gather and lynch me for this one day).

There's also a bunch of vector graphics libraries around, like Anti-Grain Geometry and Cairo, etc. I haven't used any of these, but I have plans to do so one day :). Also, of course, there's OpenGL (and I guess DirectX too, since you're using Windows). OpenGL and DirectX are primarily for accelerated 3D graphics, but you can easily do 2D things in them as well, basically treating it like another vector graphics library (but very simple, compared to AGG or Cairo). OpenGL is easy to set up with SDL.

- Gerry

* A future version will have multi-window support, but that's not going to be out for quite a while yet.

05-22-2006 at 02:32 AM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Beef Row
Level: Smiter
Rank Points: 471
Registered: 12-28-2005
IP: Logged
icon Re: WinXP C++ compiler and graphics library (0)  
asmussen wrote:
Cygwin also comes with several graphics libraries including gd,gtk,imlib,ImageMagick/GraphicsMagick,etc... Also, many open source graphics libraries such as libsdl can be compiled under the cygwin environment. Cygwin is especially useful if you are proficient in a Linux/UNIX environment.

http://www.cygwin.com/
http://www.libsdl.org/index.php


Thanks.. I'm trying Cygwin, since I'd rather like to boost my Linux proficency... its at more or less a survival level. Quite intimidating trying to pick what packages to start with, even though I can always change them, of course. Any recommendations on which of the graphics libraries would be a good starter? And if you know of an online tutorial or set of small projects for first time users of said library, that'd be wonderful.

____________________________
"Now I will repeatedly apply the happy-face rule"
05-22-2006 at 02:56 AM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Beef Row
Level: Smiter
Rank Points: 471
Registered: 12-28-2005
IP: Logged
icon Re: WinXP C++ compiler and graphics library (0)  
trick wrote:
Cygwin doesn't come with an IDE. If you want that, some people seem to like Dev-C++ (I've never used it myself, though). It includes a mingw compiler.

As for graphics library, that depends on what kind of graphics you want.

wxWidgets is a GUI library, not so well suited for games but nice if you want a window w/menus, buttons, checkboxes, etc. I don't know if it has any graphic primitive drawing routines, though, as I haven't used this myself. (Yes, I keep recommending things I haven't used. I'm sure a mob will gather and lynch me for this one day).


Thanks for the breakdown of the various libraries.... what about GTK? For now I'm installing that... and I'll take a look at wxWidgets.

To be more specific on what I'm interested in when I'm coding for myself, I like developing fractals and other mathematically oriented simulations (not in the game sense ;-) ), preferably with a decent GUI that let you experiment with "If i change this, what will happen?"

Here's a sample of what I did with Java, should give you a better idea of what functionality I'd want...



Basically, my ideal would be a library with a fairly basic event-handling GUI and support for direct primitive operations.

Being able to draw complex shaded shapes, render existing images and similar are currently quite low priorities.


____________________________
"Now I will repeatedly apply the happy-face rule"
05-22-2006 at 03:23 AM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Briareos
Level: Smitemaster
Avatar
Rank Points: 3516
Registered: 08-07-2005
IP: Logged
icon Re: WinXP C++ compiler and graphics library (+2)  
Beef Row wrote:
Basically, my ideal would be a library with a fairly basic event-handling GUI and support for direct primitive operations.

Being able to draw complex shaded shapes, render existing images and similar are currently quite low priorities.
That sounds to me like you're looking for a GUI toolkit, not a graphics library - and yeah, wxWidgets and GTK+ are both good options.

You could also give Qt a try, which also is a cross-platform C++ GUI toolkit, although it's signal/slot mechanism is different from other GUIs.

____________________________
"I'm not anti-anything, I'm anti-everything, it fits better." - Sole
R.I.P. Robert Feldhoff (1962-2009) :(
05-22-2006 at 07:54 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
AlefBet
Level: Smitemaster
Rank Points: 979
Registered: 07-16-2003
IP: Logged
icon Re: WinXP C++ compiler and graphics library (+3)  
If for a graphics library you want something you can draw on, you probably want SDL or OpenGL. (SDL is good for 2D graphics and OpenGL is good for 3D, but either can do either and they can actually be used together.) They give you a powerful framework for drawing stuff, but little if any support for GUI widgets, certainly nothing like what's available for Java.

If you want a toolkit for doing GUIs, then I recommend either Gtk (specifically Gtkmm for C++) or wxWindows. They're both popular and pretty straightforward to use, and also cross-platform and OSS. GUI toolkits are designed to do widgets like buttons, textboxes, labels, etc., and although you can do straight drawing on them a pixel at a time, they're not designed for it and you won't get anywhere near the speed you could get from, e.g. SDL. I personally use Gtkmm for GUIs. Qt is also mature and popular, but if memory serves me, it doesn't have a free license under Windows (I could be wwrong about that). The big thing that turned me off with it is that to use it you put your C++ code through a preprocessor for Qt, essentially making your programs to be written in a variant of the C++ language, instead of using straight C++. I don't like this because I prefer to write code so it's as portable as conveniently possible and also because it has the potential to confuse developer tools. Another minor thing I don't like about Qt is that it essentially does everything: GUI, threads, printing, etc. I prefer to mix-and-match the best libraries for each job. Not saying you can't do that with Qt, but it's not envisioned. On the other hand, being able to do everything is probably what some people like a lot about Qt, so YMMV.

If you're used to an IDE (I've never used DJGPP), the best free C++ compilers (and many of the best non-free ones) don't give you that. They only give you the compiler and libraries. So you'll need an editor and a build tool. For an editor, I recommend GVim or Emacs as quality, powerful, cross-platform OSS editors, but you can use pretty much anything that can save a text file. (Even MS Word, although I'd try to talk some sense into you.) WRT build tools, you don't actually need one for very small projects, but they're very handy for even medium sized ones, so I'd get used to them. I recommend SCons for a powerful and flexible one, or Make for a standard traditional one. Make will be already installed on just about any Unix-like system you can find, although SCons will usually be available for most of those systems if not installed by default.

Too much talking. I shut up now.

____________________________
I was charged with conspiracy to commit jay-walking, and accessory to changing lanes without signaling after the fact :blush.

++Adam H. Peterson
05-22-2006 at 06:15 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
Beef Row
Level: Smiter
Rank Points: 471
Registered: 12-28-2005
IP: Logged
icon Re: WinXP C++ compiler and graphics library (0)  
AlefBet wrote:
If for a graphics library you want something you can draw on, you probably want SDL or OpenGL. (SDL is good for 2D graphics and OpenGL is good for 3D, but either can do either and they can actually be used together.)

GUI toolkits are designed to do widgets like buttons, textboxes, labels, etc., and although you can do straight drawing on them a pixel at a time, they're not designed for it and you won't get anywhere near the speed you could get from, e.g. SDL.

So would it be possible to build an interface in, say, GTK and have an inner panel using SDL routines for rendering? And do so with decent performance?

Specifically an earlier post made it sound like SDL demands the entirety of whatever window it would be using, so maybe that would require something else, or just seperate windows for interface and display?

Oh, and thanks to everyone so far for some very helpful responses. I'm getting a much better idea what tools I should be focusing on, and honestly I never really even made a mental distinction between an interface and other graphical frills before... when I was first learning C++ I saw them as "Those confusing things I can't seem to quite work out, and which if I do won't be portable anyway", and in Java everything was pretty much already there at my fingertips.

____________________________
"Now I will repeatedly apply the happy-face rule"
05-22-2006 at 06:38 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
AlefBet
Level: Smitemaster
Rank Points: 979
Registered: 07-16-2003
IP: Logged
icon Re: WinXP C++ compiler and graphics library (+3)  
Beef Row wrote:
So would it be possible to build an interface in, say, GTK and have an inner panel using SDL routines for rendering? And do so with decent performance?
I haven't done it, but I believe I've seen references in the documentation to making an interface with Gtk and rendering within it using OpenGL. Not sure if it could be done with SDL, though. My uneducated guess would be that it can't or if it can, it would be tricky. I'd ask Google, though, if I were you.

. . . In fact, I just did and it looks like I may have been wrong. I found this: a SDL widget for GTK, although I don't know how usable it is.

____________________________
I was charged with conspiracy to commit jay-walking, and accessory to changing lanes without signaling after the fact :blush.

++Adam H. Peterson
05-22-2006 at 08:58 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Other Boards : Anything : WinXP C++ compiler and graphics library (Which ones should I get?)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.