Skip to main content
gamedev.net
🔒 Locked

Line drawing algorithms.....

Started by Quantum Nov 7, 2000 at 5:52 AM 2 replies 450+ views
Original Post
Quantum
Quantum
Does anyone have a working line drawing algorithm handy? GDI is sooo slow, and I cant get the one Lamothe provides in WGPFD to work propley... I think it has something to do with the surface pitch... and it doesn''t even look very good. I''m just attempting to write a simple wireframe 3d engine using DDraw . Thanks...
clonemaker
clonemaker
quote:
Original post by Quantum

Does anyone have a working line drawing algorithm handy? GDI is sooo slow, and I cant get the one Lamothe provides in WGPFD to work propley... I think it has something to do with the surface pitch... and it doesn''t even look very good. I''m just attempting to write a simple wireframe 3d engine using DDraw .

Thanks...


    
void line(int x, int y, int x2, int y2) {
float step = ((float)(x2-x+1))/((float)(y2-y+1));
float fx= (float)x;
for (; y<=y2; y++) {plotpixel((int)fx, y);fx+=step;}
}
cmaker- I do not make clones.
Uthman
Uthman
With VERY little effort, one could get the above algo working with >> floating points << to make it a hellofalot faster .
"a low level aho master like you couldn't kill me even if I let you"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.