Thread: Drawing a line or somethink like that...

  1. #1
    Unregistered
    Guest

    Question Drawing a line or somethink like that...

    I have red a lot of diferent threads about drawing a line, but it's wery strange that you have a computer with (GeForce 2) and you have to use screen 320x200 256 colors. And still its prety dificult any way. So can somebody give me source code for drawing line or puting pixel(with rich coments)??

  2. #2
    napKINfolk.com napkin111's Avatar
    Join Date
    Apr 2002
    Posts
    310
    Yeah, that would be great...I am also quite interested in that(and I have a GeForce 2).

    napKIN

  3. #3
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    Here are some algorithm implementations.
    http://www.cs.unc.edu/~mcmillan/comp...re6/Lines.html

    Using DirectGraphics or SDL makes the job a little bit easier but low level graphics isn't a relatively simple topic. There is a great deal of math involved as well.

    I would suggest using SDL first, as it is very simple to use. www.libsdl.org
    In the video subsection of the documentation area there is a putpixel function which you can use in combination with the algorithms above to do what you need to.
    If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?

  4. #4
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    300x200x256? What does you resolution and color depth have to do with drawing a line?

    In Windows you first move the cursor to the line start point with MoveToEx() then draw the line with LineTo(). Draw a pixel with SetPixel() or SetPixelV().

    In DOS/Console you use some form of gotoxy() (check the FAQ, based on your compiler you may have to write your own gotoxy() function). The FAQ covers graphics in console as well as giving some links that should help you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 19
    Last Post: 05-30-2007, 05:47 PM
  2. Read only one line using seekg
    By RedZippo in forum C++ Programming
    Replies: 3
    Last Post: 03-31-2004, 11:10 PM
  3. GDI Drawing a stupid line!
    By Bajanine in forum Windows Programming
    Replies: 4
    Last Post: 05-08-2003, 09:00 PM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  5. Question About Line Drawing with Messaging
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 06-06-2002, 11:47 PM