Secret Squirrel was once rumoured to have said:
> Hello,
 
> Would draw a nice line across the screen for me, what could be
> simpler ? With this I spend hours creating little solutions to
> problems, such as simulating the swinging of a clocks pendulum with
> a bunch of white and black lines along with a mathematical
> function. This taught me a lot about programming, i'm wondering if C
> under Linux has the same capabilities. I trust it won't be as easy
> as the one liner mentioned above, I don't even know if I can draw
> lines across a console as you can in QBASIC. What does it take to
> draw simple QBASIC style graphics with C under Linux ?

C is ultimately more flexible than QBasic ever was.  This works both
ways however.  Some APIs are also far more complicated.

For graphics, you have 5 main choices:

  Xlib.  This is all nice and fine until you start handling colour.
    X11 also has a fairly sane event system.

  svgalib.  Old.  Decrepit.  Forgetit.  However, it does draw straight
    against the console, IFF your video card is supported.

  ggi.  svgalib's sucessor.  Privatives shouldn't be too painful.
    Interfaces with many rendering systems, so you should be able to
    use it most anywhere.

  fbdev.  Linux has a framebuffer console option in the kernel which
    will let you mmap /dev/fb0, and acquire a direct memorymap of your
    framebuffer's video memory.  You have to do all the hardwork of
    linedrawing yourself in this circumstance.  I think ggi can
    interface directly with fbdev.

  OpenGL.  Don't Laugh. :) X+GLX isn't actually that hard to program,
    and OpenGL has Line and Polygon primitives standard.  Colour
    handling is also much simpler than standard X.  Oh, and your
    OpenGL calls are moderately portable - only your X and GLX related
    calls will need to be changed to run on another platform.

Personally, I'd stick with Xlib or OpenGL.
-- 
--==============================================--
  Crossfire      | This email was brought to you
  [EMAIL PROTECTED] | on 100% Recycled Electrons
--==============================================--

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to