Solved

How Do You Draw A Line With Direct Draw?

Posted on 2002-06-13
5
4,033 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is the process to start developing games for the PS 4 4 133
scores100 challenge 3 136
scoresClump  challenge 31 150
WordPress, WooCommerce, to Authenticate an online service? 2 119
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…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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