ways to draw graphics

Aug 3, 2009 at 12:53am
Please fill me in on the different ways to draw things to the screen in a C++ program. I already know of the windows GUI, DirectX, and OpenGL. Please explain what these are and how they work. I am not looking for a tutorial. I think currently they are just bunches of code that talk to the graphicsCard and moniter excluding the windows GUI. Please correct me if other wise. Thank You!

Also is it possible that I could possibly write one with C++ code. I know it would be incredibly hard but I just would like to know if it is possible, thanks.
Last edited on Aug 3, 2009 at 12:55am
Aug 3, 2009 at 2:38am
There's not much to tell, really. They're just libraries you can use to draw.

WinGDI ?and DirectX? are specific to Windows, so they're not cross-platform friendly. If you would like to target Mac and Linux users, OpenGL is a friendlier option. Shake the Windows-only development trap by not getting sucked into it in the first place! </soapbox>

I may be wrong on some technical points here, but this is more or less to give you a very general idea.

The chain-o-command is like so:
Your Program -> Graphics library -> Video driver -> Video card -> Monitor

Your program uses a graphic library (such as DirectX, OpenGL, or a higher level widgetry lib like WinAPI/WinGDI) to draw things. This graphics library relays this information to a video driver, which translates it into a series of register reads/writes that the hardware (video card) can understand, which sends a signal to the monitor telling it what to draw.

Different libraries all do pretty much the same thing, they just go about it in different ways and/or have different goals. For example WinAPI/GDI is geared towards making an interactive program with widgets, all of which uses a theme common to the entire OS. The program need not worry about all sorts of common drawing tasks, such as drawing individual buttons, caption bars, printing text, etc, etc. DirectX and OpenGL don't do all those kinds of things for you -- if you want to do something that seems simple (like print text), it might be a surprising amount of work, because you have to draw it all yourself. Conversely, DirectX and OpenGL make it much easier to do other things, like depth testing, alpha blending, rotation, scaling, and other 3D stuffs.

3rd party widget libs like Allegro, wxWidgets, FLTK typically add another layer to the process (fitting between Your Program and Graphics Library on the above chart). This extra layer allows them to be portable to other platforms.

Also is it possible that I could possibly write one with C++ code.


Yes it's possible, but it's not practical in any sense of the word. Nor is it a good idea.
Aug 3, 2009 at 2:51am
Thank you very much, you must be an expert Programer thank you for taking the time to answer the question.
Topic archived. No new replies allowed.