Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

commands needed

Status
Not open for further replies.

toast

Programmer
Apr 16, 2001
6
0
0
CA
ive been doing some 3d graphics in basic language, but it was way to slow, so i decided to change to C, then asm later.
my pathetic problem is that i dont know the commands for drawing a dot, or a line.
i know the structure, and flow control for programs. i just need to know how to draw a pixel! and what header files do i use?

oh, and im using turbo C 2.0
 
That depends on what compiler or IDE do you use... If you're working in BC Dos environement, the graphics header is graphics.h. You use then putpixel,setpixel, line, lineto, moveto etc... you find them easily in the help provided. But be sure that this is way to slow aswell, so the next step will be ASM.

If you are working in a windows environement, this gets a little bit complicated, you have to create a device context (DC) with CreateDC,CreateCompatibleDC,GetDC etc., and then use WinApi functions to draw on that device context.
But this can be slow too.

I dont' know how much experience do you have with 3d graphics, but generally, when using provided drawing functions, the result will be generally slow.
There are 2 usually workarounds for this:
1. You write directly in the video memory (via ASM)
2. You draw first in a bitmap, then display the whole bitmap on the screen, which works fine in Windows and Linux graphic environements.

i hope i answered your question, but still, the best thing you can do is to dig the HEEELP!!
 
no, i dont really want to get into asm yet, putpixel will work fine
but now how do you use the initgraph command? the help file doesnt really explain all that much, just give a simple example, and that'd help a load
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top