Home > General Development > Learning to Draw Basic Graphics in C++Learning to Draw Basic Graphics in C++ Eugenia Loli 2004-08-15 General Development 15 CommentsLearn how to use C++ code to create basic animated graphics in this chapter from “Beginning Game Programming” by Michael Morrison.About The Author Eugenia LoliEx-programmer, ex-editor in chief at OSNews.com, now a visual artist/filmmaker.Follow me on Twitter @EugeniaLoli 15 Comments 2004-08-15 9:21 pm lol, very useful Not only is it very Windows minded, but afaik GDI is soon to be depricated in favour of Avalon. Either this tutorial is 10 years old, or the author was very bored. 2004-08-15 9:29 pm Seeing as companies are still writing software to run on DOS, I think GDI will also be around for a very long time (lets not forget a lot of people/companies still run Win98 because it works for them or they can’t afford an upgrade). I haven’t really read the article, but I skimmed a little and it looks very familiar 2004-08-15 9:30 pm Um, i doubt GDI would be depricated .. I think avalon is an alternate, not replacingment. but whatever.It’s kind of lame that these things are titled things like ‘learn how to do graphics in c++’ since c++ has nothing about graphics as part of the language. It should just be titled ‘Drawing images with GDI” or something of the like, emphisizing API rather than language. 2004-08-15 9:48 pm I think this article should be re-titled. To something like ‘Graphics in Windows’ or something like it.Ansi C++ doesn’t natively provide ways to manage GDI, GDI is a non-ansi implementation of Microsoft Windows Graphics only. 2004-08-15 10:13 pm Ansi C++ doesn’t natively provide ways to manage GDI, GDI is a non-ansi implementation of Microsoft Windows Graphics only.Oh really Capt. Obvious? And to think I was under the impression that the C++ steering committee was considering adding the Windows GDI api to the C++ standard. 2004-08-15 11:10 pm Ok, there was only two pages right? Because that’s as far as I got and it seemed horribly obvious… 2004-08-16 1:21 am Keep looking, there’s 5 pages =]In college I had a Win32 programming class which did a lot of this kind of stuff, and I think there could be better examples (like using 2d stuff in OpenGL) rather than getting people into the hideous Win32 hairball, especially as newer tech is leaving behind GDIhttp://www.opengl.org/resources/tutorials/ here are some links to stuff that might be more useful (some even geared to win32 and MFC)p.s. hungarian notation sux 🙂 2004-08-16 1:31 am Oh, but C++ does handle “graphics” natively. After purchasing an old (at the time) book entitled “Black Art of 3D Game Programming” and skimming through it, I managed to throw some code together that directly addressed the memory where the frame buffer was being stored. I managed to write a screen filling program, then learned OpenGL. That experience taught me the truth to C++’s horrible reputation for pointers. Fun learning experience, though. 2004-08-16 6:25 am He should have targeted DirectX, OpenGL or SDL. But you he is teaching about simple 2D graphics not teaching you to write DOOM III. Once you learn about graphics in one system then you should be able to apply the knowledge to any graphics system and any language and produce a game. Learning 3D graphics is different and requires a lot more maths and mathematical understanding.Unfortunatley from this article you cannot tell if the author goes into other important details of game programming such as* Collision detection* Input* Game loops and decoupled loops* AI* Asset managment (That is keeping a list of things in or out the game world as it is running)* “Gameplay”The book only seems to cover 2D graphics, music and sound effects. 2004-08-16 7:07 am Hungarian notation does not suck , i am romanaia and usualy romanians with hungarians are like french and mcdonalds.I have a colleague programmer hungarian and he is quite a trained man.no matter what , Transilvania is in Romania.😀 (notice on OS News post comment : “p.s. hungarian notation sux :-)”,by zeph ) 2004-08-16 11:30 am If you mean where you blit to A0000h, I wouldn’t really call that native C++ graphics. 2004-08-16 2:40 pm When you have two dozen APIs and over 3000 functions to deal with hungarian notation is a wonderful gift, makes the thickest win code read like a letter to mom, dive in anywhere. If you don’t know how to read it and never take the time to learn the point it looks just like so much garbage. “What a waste of time, I know my code…”, then do it for the other guy and the poor bastard who will inherit your cryptic mess.I don’t know if anyone has ever noticed but there is no third dimension on a computer display.Charles Petzold rules! 2004-08-17 3:51 am “That experience taught me the truth to C++’s horrible reputation for pointers.”What horrible reputation is that?Most of what people percieve as the fault of a languageis usually the fault of poor programming forethoughtor technique.Were you filling the screen using a linked list ofscreen pixels? 2004-08-17 4:10 am “Were you filling the screen using a linked list ofscreen pixels?”hahah thats greatI wrote an OS for a school project once, pointers are godsend. 2004-08-17 6:13 pm Hungarian notation does not suck , i am romanaia and usualy romanians with hungarians are like french and mcdonalds. Hi there! Care to take a look at my Romanian Spelling Reform proposal? It’s at http://www.terravista.pt/enseada/6172 , though that’s a (very) old version. Take notice I know very little Romanian.‘Hungarian notation’ refers to the pratice invented/popularised by a MS guy who used named his variables awfully to represent type, scope, size, and so on in a systematic way.