Slashdot Mirror


Linux Graphics Programming with SVGAlib

A technical book with personality? Chromatic claims just that in his review of Linux Graphics Programming with SVGAlib. If you're a graphics guru, or are looking for a book that describes a lot of the low level functions that put pretty pictures on your screen, this one sounds like one you should at least consider.

Linux Graphics Programming with SVGAlib author Jay Link pages 513 publisher Coriolis Open Press rating 7.5 reviewer chromatic ISBN 1-57610-524-5 summary A tour of the SVGAlib library, designed to help you create new Linux applications or port existing applications to Linux.

The Scoop XFree86 isn't the be-all end-all of Linux graphics. Consider the embedded space, or dedicated turnkey apps, or console games, or... Jay Link introduces readers to SVGAlib in a flawed, but entertaining and useful tutorial. (If you've never heard of SVGAlib, it's a Linux-specific graphics library providing fast functions for full-screen use, joystick and keyboard input, and even 3D. It's undergone development and refinement for a few years, and it's easy to use but still powerful.) What's to Like? More than a listing of SVGAlib functions and their uses, the author covers a wide scope of graphics topics. They're all explored in the context of SVGAlib, but the basic principles apply to other libraries. Monitors display information the same way, polygons and primitives have the same algorithms, and something has to save the background before you draw something over top of it. The first three chapters cover libraries, competing tools, graphics modes, hardware fundamentals, and the primitive primitives. It's a good introduction to graphics in general.

Starting simply, SVGAlib functions obviously build on each other. For the most part, so do the chapters. Once you've mastered setting pixels and drawing lines, it's time to draw circles and arcs or fill in your shapes. You'll want fonts after that, and then animation. Basically, this is a book you can read straight through with little trouble. Link travels a lot of ground -- input devices, 3D development, raytracing, animation, and user interfaces. Appendices B and C list and describe the vga and vgagl functions of SVGAlib. Though usually short, the descriptions have information enough to be useful to a casual programmer, often listing caveats and gotchas.

The most enjoyable part of the book, though, is the author's enthusiasm. It's obvious he had great fun in writing the book, and that shines through his prose. It's infectious -- he's found something cool and wants to share that with the world. There's room to grow, too. The last two code chapters build a simple paint utility and discuss ways it could be improved. If you've done your homework up 'til that point, you should be able to complete it and add more whizbang features at will.

What's to Consider? The author's pretty casual. It's refreshing to read a technical book with personality. If you're a big X fan, though, or a closet Microsoft sympathizer, you might disagree with Link's rhetoric in a couple of spots. Of course, those aren't the people likely to pick up the book, leaving the rest of us free to chuckle along with the personable prose.

Two things might put you off if you're considering the purchase. First, it's not precisely a tutorial. Some chapters have pages of source code with little actual commentary. If your C-reading skills are low, be prepared to do a lot of homework to figure out what's going on. Second, there's also not a lot of explanation of the math involved. In places (geometric shapes, advanced primitive drawing, ray tracing) either dig up those old trigonometry notes or a battered copy of Michael Abrash's Zen of Graphics Programming (recommended in the text). This isn't an exploration of specific graphics theory as much as an exploration of the library.

The only thing I really disliked was the book's formatting. As is usual with techie books, warnings and notes are interspersed throughout the text. In a few spots, there also are glossary-like definitions mingled with notes, text, and figures in a hard-to-read mess of words, lines, and icons. More consistency would improve the readibility. Having additional explanations would have helped, but most of the code is clear enough that the a-ha factor comes into play. (Moderately experienced programmers can read the accompanying code and description and things will click the first or second time through). The overall tone says, "Here are the tools, now go explore and play and have fun."

The Summary Somewhat experienced programmers with a decent math background will get the most out of this book. It's an entertaining look at a library I'd overlooked for quite some time. For a good introduction to SVGAlib (and a healthy dose of fun programming), check it out. Table of Contents
  1. Getting Started
  2. Graphics Basics
  3. First Programs
  4. Complex Shapes, Formulas, And Functions
  5. Color
  6. Shades, Fills, And Patterns
  7. Fonts
  8. Fractals
  9. Graphic Files
  10. Basic Animation
  11. Polygons
  12. 3D Images
  13. Raytracing And Photorealism
  14. Game Basics
  15. Using The Mouse And Joystick
  16. Landscapes
  17. A Look At Existing SVGAlib Applications
  18. Simple Paint Program
  19. Thoughts On A GUI
  20. Video Card Drivers
  1. GNU General Public License
  2. Libvga Functions
  3. Libvgagl Functions
  4. ASCII Character Codes
  5. Chipsets Supported By SVGAlib
  6. A Brief History of SVGAlib
  7. FAQs And Troubleshooting

Purchase this book at ThinkGeek.

3 of 42 comments (clear)

  1. Re:SVGAlib is better than X. by Emil+Brink · · Score: 3

    Sounds to me like OpenGL using the DRI stuff with XFRee86 4.0 should be pretty low-latency, since that makes your app talk directly to the hardware. Oh, and modern 3D hardware sure beats (S)VGA when it comes to doing stuff on screen. (And no, I'm not karma-whoring with those links) ;^)

    --
    main(O){10<putchar(4^--O?77-(15&5128 >>4*O):10)&&main(2+O);}
  2. Use SDL and forget about X, GGI, SVGAlib, etc. by ianezz · · Score: 4
    SDL at http://libsdl.org is a LGPL library implementing a layer that can use X, SVGAlib, GGI, the Linux kernel framebuffer, and Windows and BeOS graphics systems as a backend. It is well documented, easy to use, provides a nice framework to manage input events and sound, and it is here to stay for a looong time. There are Free (as in speech) extensions to manage even more types of audio files and images, MPEG video, TrueType font rendering. There are also a couple of nice toolkits providing buttons, textfields, lists, checkboxes, etc.

    On the ohter hand, SVGAlib is SVGAlib, and as of today, I'm more inclined to trust an XFree86 X server running as root than whichever app running as root and messing around with SVGAlib. But your mileage may vary, of course.

  3. Re:Utterly useless by Anonymous Coward · · Score: 3
    I don't understand how some people here have the audacity to put down a project that doesn't quite fit their idea of something that is worth doing.

    Please, no more comments such as:
    do we really NEED that

    or

    why don't you spend YOUR spare time coding this OTHER project, which I, in my not-so-humble-opinion, think is much more interesting than the one you are working on?

    These posts are rude, and very unproductive.

    Regarding this book:

    • Nobody is making you read it.
    • Your opinion of a worthwhile book will differ from another's opinion of a worthwhile book.
    • If you think SVGALIB is a waste of the author's time, then you need definately need to shut up and write your own book on what IS important (to you).


      This book promotes learning, some people will find it useful, so STFU.