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
Solved

How Do You Draw A Line With Direct Draw?

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Game Center error 5 653
RTS game state, how is it optimally encoded in a Java byte[] ? 12 323
Python chess DS needs help 2 163
bunnyEars2 challenge 6 146
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
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…

789 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