ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I suppose...
I agree .. you don't want to give someone like a newbie root acces cause then they can wreck your system .
I wish I could find the doc.
I read that theres a way to change it so the users don't have to have root access.
I've got so many docs.. and I can't remeber what its called.
Drawbacks
There are many more applications available for X Windows than there are for SVGAlib, due to the fact that the X Windowing System is cross-platform (it runs on a variety of UNIXs). Only Linux uses SVGAlib. Also, poorly written SVGAlib applications can mung up your console, requiring a reboot. Finally, you shouldn't switch back and forth quickly between two consoles using SVGAlib graphics or you risk screen corruption (forcing another reboot).
However, it is a myth that SVGAlib is a security risk. While SVGAlib apps must be setuid root, that privilege is given up immediately after execution. There is no need to be concerned. In summary, despite the aforementioned problems, SVGAlib's speed and ease of use make it attractive in many situations. Especially if you just want to doodle on the screen.
To compile this code, use the regular gcc compiler. You'll also need to link to SVGAlib with the -lvga command. Lastly, I suggest using -O3, the best level of optimization. So here's our command:
gcc -O3 -o sample sample.c -lvga
Then, to make it usable by non-root accounts, type:
...i suppose that is better than setting the /dev/* to be writable by users....
but, you still lack the cross-platformness, though that may not be part of your agenda...hence it is not a problem (exept for non-linux users)...
here's the same article on another site that isn't crowded with a giant M$ picture that may (or may not, on your screen) ..block some of the text.. also the one i posted before has problems display #include statements ??
...also , in case you do change your mind about SDL....
there is a book 'Programming Linux Games' by 'No Starch Press' ...that focuses on using SDL for graphics, and i think OpenML for audio (don't feel like checking) ...among other stuff, they basically take you through the process of building a small (but playable (if you're bored)), game.
I just dont want you to know I'm not throwing opinions out of my ass about SVGAlib. I have the book , "Linux graphics programming with SVGAlib", and this is where i pull my references from. I will now list the advantages and disadvantages of SVGAlib, taken from the book .
ADVANTAGES:
1) Speed, SVGAlib sends data straight to your video card.
2) Ease of Use, the functionality of SVGAlib cant be beat. There is also little start up time for users.
3) Comprehensiveness, You dont have to download a new server everytime you change your hardware.
DISADVANTAGES:
1) Portability, SVGA functions will only work with SVGAlib and are useless outside of the Linux environment.
2) Perceived security hole with setuid requirement, In order for SVGA lib to access the hardware, it must be ran as root or as a setuid root process.
3) Inablility to display multiple windows simultaneously.
4) Fewer cards supported.
5) Little availiblilty of apps.
6) Networked Graphics not possible, machine must have svgalib installed.
-----------
Keep in mind that this book was written in 2000, so i must comment on the following pro/cons I just mentioned.
note: The author was comparing SVGA and XWindows.
advantage 2) SDL is rediculously easy to setup and program with, and it covers graphics, audio, event handling, network gaming, etc etc etc
advantage 3) the current form of XFREE is driver module based, back when this book was written you had to download a new server written specifically for your hardware each time you upgraded or changed hardware.
Disadvantage 4) SDL supports anything the X server supports, and also can work in the frame buffer console, in AScii art mode, etc etc
Disadvantage 6) The author is talking about how the Xserver can be run on a networked machine and clients can connect to the server and use its X services. SDL can work over a X remote connection, as long as the SDL libs are installed on the remote machine.
And I agree totally jinksys. The reason I'm learning it is I'm trying to compare different graphics libraries and figure out which one is better.
I wasn't saying you didn't know what you were talking about.
And I'm not saying svga-lib is the best.As a matter of fact I'm thinking of switching over to SDL in a couple of days.
I do wish I could find a book or a decent manual for SVGALIB though.
It would make the learning alot easier.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.