LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-09-2003, 03:59 PM   #16
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35

I know it doesnt make a difference to you, but giving someone a program that requires root access and is not crossplatform, just isnt kosher to me.
 
Old 11-09-2003, 04:17 PM   #17
WindowsBurner
Member
 
Registered: Nov 2003
Location: In chaos
Distribution: OpenSuse
Posts: 293

Original Poster
Rep: Reputation: 30
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.

I don't even know if I still have it.
 
Old 11-09-2003, 04:21 PM   #18
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
..i've have also read that you can change that root 'requirment' somewhere , ...maybe it was a *feature* of svgalib-2.x. i'll check around too...
 
Old 11-09-2003, 04:35 PM   #19
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
Quote:
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.
Code:
#include <stdio.h>
#include <vga.h>

int main(void)
{
   vga_init();
   vga_setmode(5);  /* G320x200x256 */
   vga_setcolor(4);
   vga_drawpixel(10, 10);

   sleep(5);
   vga_setmode(0);  /* TEXT */
   return(0);
}
Quote:
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:


chmod u+s
http://www.developer.com/open/print.php/616261

...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)...

Last edited by jhorvath; 11-09-2003 at 04:41 PM.
 
Old 11-09-2003, 04:39 PM   #20
WindowsBurner
Member
 
Registered: Nov 2003
Location: In chaos
Distribution: OpenSuse
Posts: 293

Original Poster
Rep: Reputation: 30
Thanks! jhorvath that really helped.
 
Old 11-09-2003, 04:46 PM   #21
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
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 ??

http://www.svgalib.org/jay/beginners...ers_guide.html
 
Old 11-09-2003, 04:54 PM   #22
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
...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.
 
Old 11-09-2003, 04:58 PM   #23
WindowsBurner
Member
 
Registered: Nov 2003
Location: In chaos
Distribution: OpenSuse
Posts: 293

Original Poster
Rep: Reputation: 30
Yep,

I was ready it this morning.It's actually not half bad.I'll finishing it sometime.
 
Old 11-09-2003, 05:59 PM   #24
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
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.
 
Old 11-09-2003, 06:21 PM   #25
WindowsBurner
Member
 
Registered: Nov 2003
Location: In chaos
Distribution: OpenSuse
Posts: 293

Original Poster
Rep: Reputation: 30
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.
 
Old 11-10-2003, 04:25 AM   #26
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
Just wanted to make sure you knew both sides of the argument before you chose sides
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to learn programming languages like python reading tutorials? cyto Programming 25 12-25-2004 08:40 PM
Programming in Java, looking for a good place on the web for tutorials or books.... jmax24 Programming 3 04-18-2004 04:18 AM
Svga Thorgal Linux - Software 2 12-11-2003 03:16 PM
looking for programming tutorials / books, etc markus1982 Programming 18 03-12-2003 04:33 AM
svga lib & 3+ button MS mouse..help.. mavness Linux - Software 0 08-22-2002 01:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration