Getting started in computer graphics programming

Good night every one.
As I'm a pretty curious guy that loves to know a lot of different subjects, can someone help how can I make graphical programming using C in windows or ubuntu, I have heard about openGl, the know windows DirectX, and some projects like Cairo.
So the main question is how can I draw something in 2D, no need to do 3D(for now 8-)) using C?
If not in C then C++, I have found this site and the writer talks about SDL, but the site is pretty old and I don't know if SDL is still being developed or if it is advised to use it:

if your helbent on using C (why I dont know for simple 2d stuff in 2010, I would use something like processing or love to get the concepts down) SDL and allegro are probably the 2 biggies

Thought that SDL was some minor thing, but appears its not, actually this is going to be used as a study platform about plasma effects and fractals, maybe in December I will have real time, as I will have university tests in the next week >:(

Something to keep in mind; its possible to do "2D" with OpenGL...

If you really want to learn how to use OpenGL - check this site:

If you want to learn some (or a lot) of the "old school" stuff (and/or the hows behind OpenGL and 3D graphics in general), check out:

Actually, Programmers Heaven is a great resource for all kinds of tips and tricks over a myriad of languages and tasks. Hornet is an old "demoscene" site. Pouet is the current "demoscene" site - if you really want to know how to do the fast tricks of the demo coders, its a great place to go learn.

I could also recommend an absolute metric ton of books on the topics of game and graphics coding, but most of what I would tell you about would be "old school" stuff, and may not interest you (I have a few books on graphics coding from the late 1960s and early 1970s, for instance).

If you can handle the mathematics and theory, you might check out the ACMs Graphics Gems repository:

Generally, much of the stuff you see/hear about as "new" (such as a "new" graphics technique used by a video card, or in a particular game engine) is really "old hat" - having been developed and/or investigated by researchers in the past (sometimes, long ago in the past) - but only now possible to reduce the algorithm to silicon or software because the speed and/or hardware is there and available to make it practical for mere mortals to purchase.

An interesting set of books to see how it was done "old school" PC style (in both C/C++ and in BASIC) was the series of 3D and 2D graphics books written by Lee Adams in the 1980's (I call them the "High Performance Graphics" series of books).

Then there's always the HUGE Michael Abrash tome "Graphics Programming Black Book" - its kinda old too, but still has a lot of great information in it.

On the topic of SDL: Its still very much used, and developed, from what I undestand. If you want to try something interesting, though, from an OpenGL standpoint, look into VPython:

Yeah - its python-based - but it makes it dead simple to code 3D graphics with real physics interaction (this is what it was originally designed for - a system to teach physics thru programming 3D graphics).

Lastly - something to keep in mind: Whatever you do (unless you are fairly young and have a lot of chutzpah and passion for 3D graphics coding), don't make the mistake of investing tons and tons of time into a 3D graphics engine; chances are, some other company has already developed something much better, sitting on top of OpenGL/Direct3D, and it might even be open-source (though some of the really great engines are closed, proprietary, and expensive). I am not meaning from discouraging you from developing an engine; certainly, go for it if that is your passion, and you really want to learn it. It is just something that can "take over your life", and if you were intending on developing something that depended on the engine, you can find yourself "sucked into" developing the engine, and not developing the application upon which the engine was developed for! Its kinda like "feature creep" at that point.

One time, long ago, I developed a software 3D engine for VB5/6, which used a DLL I developed in VisualC++ for a triangle rasterizer; I was getting 30 fps on the hardware of the day (P200 or so) - not the greatest, even for the time, but not too bad for VB! Anyhow, I was writing the code, had a scenegraph engine and even basic texture mapping (affine and perspective-correct), and was working on lighting and shadows...

I took a look around and realized I was wasting my time developing an engine, since it wasn't what I wanted to really do (at the time, I wanted to develop a game - not a 3D engine) - and realized that Direct3D could do all I was doing and do it better. I did learn a lot about 3D coding; I started originally with the concept of a point; I was taking the "self-taught" methodology: "How would I do this from near zero knowledge - only knowing simple geometry, SOHCAHTOA, and the unit circle" - and built up from there to 2D rotations (made an interesting asteroids vector engine over the course of my studies), then expanded from that to 3D, matrix math, etc...

Good luck with your learning - it was fun and a blast for me; I consider it one of the highlights in my self-taught software development phases... I hope the links help out!


the examples given can also be done in javascript, its not about what language you learn it in, its HOW to do the effects

unless your a fairly accomplished C programmer for modern systems its a bit like learning to paint, but first you need to know the chemical composition of the canvas coating before you can start

which has nothing to do with the act of painting!

that being said there are plenty of tutorials for what your looking for under pretty much any language, its 2010 our computers are nasty fast, unless your doing a 1080P per pixel plasma effect a simpler interpreted language will do the job and you get to focus on more of how and why a precalulated sine wave table vs a color reference table does what it does instead of banging your head against a wall trying to just get a window to open with a double buffer

personal opinion of course

What level and type of graphic programming do you want to do? Are you interested in setting pixels across a bitmap and do your own line algorithm, or is a graphic library like GTK++ ok, which provides most primitives already (it still allows to do your pixel manipulation). Or is it more an object oriented approach like librsvg or opengl, where you define geometric objects and the actual scaling and rendering is left to the engine. Or are you more into photo and video processing, where you want to fool around with filtering and enhancement algorithms and visual perception? Or are you more into the interactive graphic aspect (in plain text: games)? And not to forget data visualisation and mathematical graphics, those open yet another filed of opportunities with very good packages to play around with.

Questions over questions and for all of them there are good and free solutions to get you going quite quickly. You just need to know what you want.


Mr cr0sh, wow, so much info and links!
I already know pouet, and I really love the demoscene, and all the super smart programmers that can create stunning visuals and audio in so little space.
I'm going to read all those links and will try to buy some of the books.
The graphics that I would like to render/create will be something in the demoscene style, dont know if it has a special name, but almost all are 2D or simple 3D graphics, I think that creating a game is way over my head, but I never say never, I already have so much projects to finish :-[
Thanks again for all the help!! ;D ;D

Its great fun to start dabbling with a 3D engine, ogre (C++) is a very powerfull open source 3D engine that is VERY capable!
Though JMonkey, a 3D engine for java, is interesting if you like to make cross-platform stuff.

2D stuff is supported by swing and awt on java, don't know any 2D stuff in regards to C / C++.

Senso- you may want to check out the TVout library.. for the cost of two resistors (maybe a couple of diodes if your v-in is twitchy on the TV) you can do basic graphics on the Arduino. The current version includes some basic things, but it is as basic as video outputs go.

A good start is to see if you can come up with something creative in 128x96 mono.. all the concepts are the same as you scale up to more complex programming... animation code is animation code, it might help a bit to fiddle at the lowest level to get a handle on the higher level stuff..

There are some DirectX codes in C++ that I've worked with before. Try googling Greg Dolley's blog, it shows some basics on how to do 2D using C++.

BTW, I can't remember much but 2D for DirectX (DirectDraw) is no longer supported, so maybe it's better to do straight to 3D. If I'm not mistaken you can do 2D in 3D too (somewhat).

And there is even an avr lib that can do color tv out, dont remember the right name now, but when I find it I will post here.
About the DirectDraw, I read the same thing about it, is 2D so bad that it is now an endangered species?

Processing can be used for 2D programming. For 3D, you'll need to move up to a more powerful rendering engine. I like OpenGL. My company has some pretty intensive OpenGL applications for displaying airplane data.

2D programming is not so much dead as obsolete. Very few 2D games any more. New development and maintenance activities are focused on user needs, which, today, involves complex 3D programming.

Maybe the smartest thing would be getting started with the 2D in processing, then jumping tho SDL or OpenGl as things evolve.