A Conversation for The H2G2 Programmers' Corner
- 1
- 2
Graphics Help
Annette Started conversation Nov 28, 2002
I'm working on learning C, and I'd like to be able to do graphics type things with it. Problem is, "graphics.h" isn't part of the standard function library. (At least, I don't think it is...) I've been using the Microsoft Visual C++ compiler, and I haven't been able to figure out a way to do graphics with it. So if you know of 1)a way to do graphics with visual C++ or 2)something (preferably free, or at least cheap) that I can download that will enable me to program graphics, I'd really, really appreciate it! Please excuse any ridiculous factual errors, etc, that I probably made in this post, as I am very much a beginner....
Graphics Help
Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista) Posted Nov 28, 2002
Could you be a little more specific about what you mean by "Graphics"...?
Plotting points? Graphs and charts? Game sprites? Photo-editing? Fractals?
I'm not a C++ user myself, but I know that there are a lot of different language extensions available, each with their own strong and weak points - an idea of what you're trying to achieve might make it easier to suggest something.
Graphics Help
Dogster Posted Nov 28, 2002
What you need (IMO) is Allegro which is free and can be downloaded from http://www.talula.demon.co.uk/allegro along with many helpfiles, documentation and a large support community (i.e. there are lots of tutorials for it about). The alternative is to do things the "proper" way and download a copy of the OpenGL or DirectX SDK. OpenGL is easier to use, but DirectX will probably run faster. I'm sure that both of the SDKs are absolutely gigantic to download. I recently downloaded the DirectX one which was a few hundred megabytes (but can be ordered on a CD, I think the only price is postage).
Graphics Help
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Nov 28, 2002
If it's just basic graphics manipulation or even skinning then I recoment the standard BitBlt graphics functions. I've used these in both VB, C++ and Assembler so no wories standard to windows, you'll have to use some hDC variable structures but the defs are included in the header file.
have a look round anyway, I'd avoid using DirectX or OpenGL unless your doing either 3D work or your looking at object theory, (like I did a few months ago).
this asumes you know how to load forms and things first.
-- DoctorMO --
Graphics Help
MaW Posted Nov 28, 2002
The key thing is that C++ doesn't have a standard graphics toolkit as part of the language, so you're going to have to poke around, see what you have and what's available, and pick one that's suitable for your needs.
I wouldn't recommend using Windows API functions though, in my experience they're generally FREAKING HORRIBLE!!!
Ahem.
Graphics Help
Ion the Naysayer Posted Nov 29, 2002
Dogster mentioned DirectX vs. OpenGL. If you're going to use one of those, it would be a good idea to read http://www.vcnet.com/bms/features/3d.html before you make a decision. If you have an nVidia graphics card, DirectX will probably render faster than GL but in my experience most other cards will render OpenGL faster.
I've also heard that programming for the DirectX API is like beating yourself repeatedly with a frying pan as compared to using OpenGL (that's why John Carmack of id software fame uses GL and not DirectX; feel free to look that up, btw...)
Graphics Help
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Nov 29, 2002
I'm a linux user and I'd recoment the windows api, it is widly available on all windows machines, it's never let me down when I do things in windows and opengl and directx are a frigin pain to init, and directx 7 used some of the api anyway for it's 2D layers.it depends if he just wants somthing that will display pritty pictures or if he's looking to make his gameing dreams come true. but I belive the question was more aimed at 'start' to program graphics.
-- DoctorMO --
Graphics Help
MaW Posted Nov 30, 2002
How did you manage to like the Windows API, when it's one of the most mismatched and cludgy things I have ever encountered?
Graphics Help
Annette Posted Dec 1, 2002
Thanks guys!
I've started fooling around with Windows API. It seems...well, workable, if not exactly my idea of fun. Allegro looks really neat, I'll probably download it in a day or so. OpenGL and DirectX look a little difficult for now, but maybe in a couple months....
Graphics Help
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Dec 2, 2002
it's to do with knowing the steps, you can't just feed someone solids you have to ween them onto it, even if the windows API is the baby food of Graphical programming.
-- DoctorMO --
Graphics Help
MaW Posted Dec 2, 2002
Only on Windows. On Linux it's XLib, which is fairly awful by itself. Or SVGALib perhaps. Or one of the framebuffer libraries. Or libgnomecanvas! Woohoo! Or EVAS, an OpenGL-accelerated 2D drawing surface with a sane API.
Excuse me while I drool.
Graphics Help
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Dec 2, 2002
Are you drooling because your name space has run out for how many libaries there are? or because you just happen to like one/all/some of them?
I'd like to get into linux programming and have only managed a couple of perl scripts, a bash script and modyfing someone's game for personal use.
-- DoctorMO --
Graphics Help
MaW Posted Dec 2, 2002
I'm drooling about EVAS actually. I must find an excuse to use that in something.
Graphics Help
Dogster Posted Dec 2, 2002
While we're on the subject, are there any (easy to use) graphics libraries that work on unix platforms generally? (Although I suppose linux only would be fine.) More importantly, ones that I can install and use without being root? The reason is, I want to run some programs at an academic department with unix and linux computers only, and I only have an ordinary login. My needs are relatively simple: I'd like to be able to output simple 2d colour graphics (i.e. points, lines, circles, text) that update in realtime. At the moment, I'm using a library (Cgraph) which creates postscript output, which is fine for what it is but is no use for realtime updating stuff.
Graphics Help
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Dec 3, 2002
I think you'll be a bit stuffed in that department. if it's unix then I have no dout the thing will be chained up two ways from sunday.
The only hope is that you have either access to an apache webserver and you could do some kindof real time displays from perl or php or another program that may beable to give you this facility.
-- DoctorMO --
Graphics Help
MaW Posted Dec 3, 2002
It's possible to install libraries like GTK as a non-root user, but it requires a bit of trickery to actually use them unfortunately
You could learn Xlib, which is likely to be available to you assuming you have access to an X system, but it's not particularly easy to use.
Graphics Help
26199 Posted Dec 3, 2002
See what libraries they already have, I guess... I certainly don't know any way to use libraries with installing 'em as root.
If it's a standard installation of something... RedHat or whatever... chances are it will already have some decent libraries. Probably.
DoctorMO... how on earth can a Linux user recommend the Windows APIs?!
That's practically an oxymoron
Graphics Help
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Dec 3, 2002
No, recomending Linux Libaries would have been stupid. he's a windows user and programmer. i.e c++
-- DoctorMO --
Graphics Help
Dogster Posted Dec 3, 2002
I can probably ask the staff at the department to install some libraries, supposing I did this what would you recommend? I'd still not be able to run programs that only root can run (e.g. programs that access the SVGA memory I think) though. I'll look into GTK and Xlib, and find out what they already have.
Graphics Help
Dogster Posted Dec 3, 2002
Just checked what they have at the department, I've made a copy of the output of "ls /usr/lib/*.a" at A890732 (the /usr/local/lib directory is empty though). Would any of these be any use to me?
Key: Complain about this post
- 1
- 2
Graphics Help
- 1: Annette (Nov 28, 2002)
- 2: Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista) (Nov 28, 2002)
- 3: Dogster (Nov 28, 2002)
- 4: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Nov 28, 2002)
- 5: MaW (Nov 28, 2002)
- 6: Ion the Naysayer (Nov 29, 2002)
- 7: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Nov 29, 2002)
- 8: MaW (Nov 30, 2002)
- 9: Annette (Dec 1, 2002)
- 10: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Dec 2, 2002)
- 11: MaW (Dec 2, 2002)
- 12: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Dec 2, 2002)
- 13: MaW (Dec 2, 2002)
- 14: Dogster (Dec 2, 2002)
- 15: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Dec 3, 2002)
- 16: MaW (Dec 3, 2002)
- 17: 26199 (Dec 3, 2002)
- 18: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Dec 3, 2002)
- 19: Dogster (Dec 3, 2002)
- 20: Dogster (Dec 3, 2002)
More Conversations for The H2G2 Programmers' Corner
Write an Entry
"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."