   DirectX8 2d Linefunction
  How would I go about making a LineTo function for 2d Graphics in DirectX8. A LineTo function like that of Win32 or MFC. -CProgrammer 
  Have a coordinate set for remembering the last position and do one line-strip after another. ;  EDIT: Rather use Endurion's approach, although it's less flexible it's possible to obtain much better performance with it. If you don't want a graphing game you probably should go with triangle strips .I bet you'd need to lock some texture/surface for drawing, and then use the nice but simple equation y = mx + c. You'd need to modify the behaviour of the drawing function depending of the characteristics of the gradient (m):m <= 1; m = 0: Just step through each x pixel and draw a value at y.m > 1: Either draw extra pixels to make sure there isn't any gap between x coordinates, or make x the subject of the equation. The equation then is x = (y - c) / m and step through each y value to draw x pixels instead.m = INFINITY: Since it is not possible to obtain a perfectly straight line by stepping through x here, you could just set the gradient to 0 and step through y instead.Remember to have a start point and a x or y limit for whichever you are stepping through to obtain coordinates for the other value.(I haven't implemented any of the above itself, and I guess the hardest part would be to lock the graphics buffer and to place coordinates there).   [edited by - Unwise owl on February 9, 2004 8:46:47 AM];  Yeah my problem is that you need to copy vertices into a vertexbuffer to draw something in Direct.X. Now in Win32 its just MoveTo and LineTo that fills the pixels. Why cant I do something similar, cause I need many different lines that keep changing so creating a vertex buffer with all of them just isnt practical. I''d gladly give up speed for ease of use on this project. Yeah how would I lock the graphics buffer and where from there. Unwise Owl: Luckily I''ve already written a function some time back similar to what you described. I just need the calculated data to be displayed.Maybe could one make one Line Object in a vertex buffer maybe just a square(2 triangles) and then have that turned and scaled for each LineTo call. Maybe someone can elaborate on this?I guess this is kinda as Endurion described.-CProgrammer ;  I''d suggest sticking with DirectDraw from DirectX 7 interface if you want to keep it simple.  You can easily plot pixels in there, and you can actually use GDI functions with it (not recomended though).  On the other hand, here''s a tutorial using Direct3D 8 to draw lines, but it uses vertex buffers of course: <a href="http://www.flipcode.com/tutorials/tut_dx82d.shtml">http://www.flipcode.com/tutorials/tut_dx82d.shtml</a> ;  Hey thanks. That fixed the problem.-CProgrammer 