Linux Graphics Programming with SVGAlib 42
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
- Getting Started
- Graphics Basics
- First Programs
- Complex Shapes, Formulas, And Functions
- Color
- Shades, Fills, And Patterns
- Fonts
- Fractals
- Graphic Files
- Basic Animation
- Polygons
- 3D Images
- Raytracing And Photorealism
- Game Basics
- Using The Mouse And Joystick
- Landscapes
- A Look At Existing SVGAlib Applications
- Simple Paint Program
- Thoughts On A GUI
- Video Card Drivers
- GNU General Public License
- Libvga Functions
- Libvgagl Functions
- ASCII Character Codes
- Chipsets Supported By SVGAlib
- A Brief History of SVGAlib
- FAQs And Troubleshooting
Purchase this book at ThinkGeek.
rock on! (Score:1)
-----
Using SVGAlib to force font mode? (Score:1)
GGI? (Score:1)
Why would I code directly to SVGAlib instead of using GGI?
I would assume that there's an SVGAlib target for GGI, so what's the point?
--
Ok...... (Score:2)
I can see where this would be useful though, maybe coding apps for older machines, and possibly make some cheap embedded stuff (kiosks, etc etc.). But does any applications still rely upon svgalib ?
"sex on tv is bad, you might fall off..."
How do you figure? (Score:1)
In what way does it have personality? (Score:1)
Maybe faster (Score:1)
Re:Maybe faster (Score:1)
But you can run it under X if you need/want to, which is a huge advantage especially for development...
--
I say this because I think it worked once (Score:1)
I already tried to get something that small with SVGATextMode but didn't get as fine a resolution.
Re:Using SVGAlib to force font mode? (Score:1)
SVGAlib is better than X. (Score:2)
I wish that there was a graphics and sound API for Linux that had the low-latency properties that DirectDraw and DirectSound do under Windows. From what I've seen, SVGAlib and OSS are the only comparable ones, and they still need work.
well... (Score:1)
Now, SVGAlib sucks for speed too, but at least it's not RAM-hungry.
-----
Linux Specific? (Score:2)
I know for a fact there's a BSD port of SVGALib.
For portability, though, GGI might be a better bet.
--
Re:Using SVGAlib to force font mode? (Score:1)
Works great!
And you get a packed pixel framebuffer to play with
I wrote a little program a while ago that showed
a starfield behind the console text.
good ol' SVGA... (Score:1)
I thing that programing svgalib for linux have similarities to old DOS svga programming, don't you think ?
Hope SVGAlib never dies, 'couse X is not always the answer, you know.
Re:Using SVGAlib to force font mode? (Score:1)
really high graphics mode with the tiny font and then exit.
so what's the use? look at it with magnifying glass or what?
Is there a method that does not use frame buffer? (Score:1)
No I want to enhance the size with a smaller font (Score:1)
Re:SVGAlib is better than X. (Score:3)
Re:good ol' SVGA... (Score:1)
SVGALib isn't interesting only for GFX gurus, it can be a good place to start for beginers too. At least learn how to draw lines before you switch to OpenGl right ?
Re:No I want to enhance the size with a smaller fo (Score:1)
"I want to use software that doesn't suck." - ESR
"All software that isn't free sucks." - RMS
Re:SVGAlib is better than X. (Score:2)
Re:GGI? (Score:1)
Umm, wrong level.
OpenGL -> GGI -> SVGALib
OpenGL -> GGI -> X
OpenGL -> GGI -> Network
OpenGL -> GGI -> DRI (Windows)
OpenGL -> GGI -> Console [slashdot.org]
etc, etc...
--
Re:Ok (Score:1)
What video card do you have? many new cards are supported.
Try GGI (Score:1)
-matthew
What about an svgalibd daemon? (Score:2)
Does anyone see any reason why this wouldn't be practicle?
Use SDL and forget about X, GGI, SVGAlib, etc. (Score:4)
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.
Re:GGI? (Score:1)
The good thing about writing for something like SDL also is that the SDL programmers have spent ages doing little optimisations and extra performance improvements for specific targets that someone writing something from scratch might not be bothered with, so in practive it's often no slower than programming for the specific target directly. For example, for X11 target, it looks to see if it has DGA authority, if not, it might try MIT-SHM extensions before resorting to Xlib otherwise.
I have to admit though, if you have the time to optimize your code and you want the fastest code possible you should code for your specific target directly.
Personally though, I would prefer fbdev over svgalib, but thats just me.
Incidentally, IIRC, someone has done a plug in replacement for svgalib that redirects access via GGI so stuff written for svgalib works on X11, fbdev, aalib etc. cool stuff and it's fast (according to the author)
GGI dead? (Score:2)
I used it anyway because I wanted something right away, but I agree with another poster that OpenGL is probably the way to go now.
--
An abstained vote is a vote for Bush and Gore.
Utterly useless (Score:2)
I mean, what can SVGALib do that X can't? If you find something, implement it in X, tadah, it supports many SVGA cards at once!
I used to play the SVGALib version of Koules, that game sure was a lot of fun
However, it was quite hard to get SVGALib to work at all.
Interesting (Score:1)
Graphics, Sound, ect.. Lib (Score:1)
Hmm... (Score:2)
So far, my choice has settled on some sort of full-screen X window interface (maybe using SDL or GGI). The driver hardware for my HMD is a VGA->TV converter, and I need a 640x480 screen @ 60 Hz refresh to get the converter working. I once got X doing it on an old Redhat box, but I lost the config settings. So, I know it is possible.
I am not sure what it would take to go "full screen" with X, or if I could use something else to drop into that mode. I like SDL for its cross platform use, plus the fact that it can work console or in X. IIRC, it also supports OpenGL, which I will need for my work.
The one thing I didn't like about SVGAlib was the root access issue. Has this been corrected yet, or is it just because it needs to access the hardware in such a direct manner, that it does this? SVGAlib, otherwise, would probably be fine for me to use...
I support the EFF [eff.org] - do you?
Re:Utterly useless (Score:3)
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:
This book promotes learning, some people will find it useful, so STFU.
Re:GGI dead? (Score:2)
2000-10-15
Yeah, it's not the most current, but i wouldn't say stagnating...
--
Re:well... (Score:1)
-----
Re:What about an svgalibd daemon? (Score:2)
svgalib 1.9.6 and root access (Score:2)
Re:SVGAlib is better than X. (Score:1)
Re:Hmm... (Score:1)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Another cross platform environment (Score:1)
btw, SDL looks very good.
Can you say "cycle sucker," kids? (Score:1)