[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] Graphics using C programming under linux



svgalib is the way to go for console graphics. For graphics under X, of
course, you have any number of options, from Xlib to the various wrapper
toolkits (GTK, Qt, Xt, Motif, etc). Of course, there is the GGI option
also available. Sample program using svgalib:

#include<vga.h>
main(int argc,char *argv[])
{
	vga_init();
	vga_setmode(4); /* Safe to assume that at least this will work.
Use lower modes if not */
	vga_drawline(0,0,30,30);	/* Draw a line from 0,0 (upper
left) to 30,30 */
	vga_getch(); /* pause and wait for the user to press a key */
	vga_setmode(TEXT); /* Restore text mode */
}

Compile this passing the -lvga flag to the compiler. An important point is
that the program has to be executed as root, or as seteuid root in order
to work. After this, try man svgalib to get the man pages on svga, and you
are on your way.

							yours,
							venu

On Fri, 21 Jan 2000, Kayomarz wrote:

>  
> Hi all !
>         Can anyone guide me how to "do" graphics using C programming under
> linux? ( would that too be done using gcc ? )  I have absoulutely no idea
> about the above;
>         A small sample programme with some explanation ( maybe to draw a
> straight line or so) may be of great assistance.
>  
> Thanks,
> Kayomarz Gazder.
>                     
> 
> 
> --------------------------------------------------------------------
> The Linux India Mailing List Archives are now available.  Please search
> the archive at http://lists.linux-india.org/ before posting your question
> to avoid repetition and save bandwidth.
> 

--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.