Solved

How Do You Draw A Line With Direct Draw?

Posted on 2002-06-13
5
4,019 Views
Last Modified: 2013-12-08
Is there a Direct Draw or DirectX function to allow you to draw a line on the back buffer?  I couldn’t find one so I’m currently using the LineTo() GDI function to draw straight on the screen.  If there isn’t a function available can you use LineTo() to draw on the back buffer?  If not is there another way of doing it.

Thanks a lot for your help
0
Comment
Question by:Plague1392
5 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 7082068
What version of directX are you using and what language?
0
 

Author Comment

by:Plague1392
ID: 7082080
Ooops, Sorry about that.  I'm using C and DirectX 8, but the book I'm reading is actually based on version 6 so a lot of what I'm using is probably more version 6.  I've been using the latest version of the DirectX data types though, e.g. LPDIRECTDRAW7, LPDIRECTDRAWSURFACE7 etc.  
0
 
LVL 1

Expert Comment

by:jdrescher
ID: 7090185
I draw my lines and other curves by using algorithms and plotting individual pixels.

Jonn
0
 
LVL 3

Accepted Solution

by:
mh2 earned 100 total points
ID: 7092458
Hi,

I have not worked with DirectX since 7, but I know in these versions there were no routines for plotting primitives like lines or circles, DirectDraw was basically a bitmap blitter.

I rarely need to draw lines, but I know of only 2 ways:
1. Use GDI like you are now
2. Lock the surface and use an algorithm such as Bresenhams to plot you pixels into your surface buffer.

As far as I know, DX 8 has know combined DirectDraw and Direct3D, so you may be able to draw lines using the 3D pimitives linking vertexts ( like a one-line wireframe ). This would probably mean requiring some form of 3D hardware, way overkill if your app does not require this ( the increased compatibility problems and raised hardware requirments will not be worth the develpment time saved ).

Thankx,
Mark
0
 

Author Comment

by:Plague1392
ID: 7095377
Thanks for the help and for naming an algorithm.  I'd been searching for an appropriate algorithm but couldn't find one.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now