Solved

How Do You Draw A Line With Direct Draw?

Posted on 2002-06-13
5
4,016 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

15 Experts available now in Live!

Get 1:1 Help Now