Really simple graphics c++ question

Started by
8 comments, last by Shadowflare 21 years, 6 months ago
I know practically nothing about graphics programming in C++, so I figured it would be best to start with just drawing pixels in a window. How do I do this? I did some research and found SetPixel, but it doesn''t seem to work...If anyone can either tell me how to do this, or to direct me to a good C++ graphics tutorial, i''d greatly appreciate it!
Advertisement
If you want to use the power of your 3D card, the most simple thing you can do is to draw a triangle. Go to NeHe''s and start with tutorial 1 and do ''em all! That''s how I learned it

Sander Maréchal
[Lone Wolves Production][Articles][GD Emporium][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

-> for beginners.
Read books on DirectX.
-----------------------------Language: C++API: Win32, DirectXCompiler: VC++ 2003
I tried to check the tutorial mentioned in this thread and it was not found. Can you re-post?
just accept for now that you won''t be able to do any easy graphics in a DOS enviroment. Trying to draw pixels to the screen in console mode without the use of an API requires some major programming voodoo. With an API it is still difficult.
Wait until you learn Windows programming. Once you start to learn that, you''ll have a much easier, and fruitful, graphics experience.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

Or you can go to www.gametutorials.com and check out all of their tutorials. Chances are something there is going to help you out.
Hi Shadowflare,

The first thing you need is documentation. It helps to know that the area of Windows you''ll be working with is called the GDI. If you don''t have MSDN on CD, go to Microsofts developer webpage and look at the docs for the GDI. The URL is http://msdn.microsoft.com/

Irawing isn''t so simple at first, because Windows wants you to go through a few steps before you get going.

Essentially, you''re going to need to create:

1. A window.
2. A handle to a device context for that window (HDC).
3. A bitmap to draw to.

Generally, the way this works is that you draw to the bitmap, and then tell the window to draw the bitmap.

It sounds like you already know step 1. Step 2 is easy (HDC myDC = GetDC (myWindow)

Step 3 can be really easy, or really complicated. I wrote my own Bitmap class that is compatible with windows (I did this so i can move the code to other platforms later), thus taking the really complicated approach. In any case, I don''t know the easy method off hand. You should be able to find it on the MSDN web page (see above URL).

Hope this helps,
Will
------------------http://www.nentari.com
quote:Original post by diggisaur
I tried to check the tutorial mentioned in this thread and it was not found. Can you re-post?

The link to NeHe is nehe.gamedev.net (the tutorials are about OpenGL).
Hi ,
I am also new to this graphic-programming thing.
First off all search for some documentation !
(Books and so on )(Andree la moth " 3d game programming" only for dos !!!!!!)get books on directx or open gl !
and so on !
It depends on what you wanna do !
if you want some source code for getting into it send me a mail
(i´ll send you that code )

_______D___

This topic is closed to new replies.

Advertisement