LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   2d graphic programming in gcc (https://www.linuxquestions.org/questions/programming-9/2d-graphic-programming-in-gcc-202465/)

pippet 07-08-2004 01:45 AM

2d graphic programming in gcc
 
i would like to know about 2d graphics programming using gcc.
The library, basic functions etc. Where do i get the info. from?
I am plannig to implement the classic line drawing algo in C

jinksys 07-08-2004 02:16 AM

libc doesn't provide any kind of graphic support. First, youll have
to decide what medium you are going to be programming for:
XWindows, framebuffer, console, etc. Then youll have to choose a
library that allows you to write to it. Xlib, SDL, QT, GTK, etc.

pippet 07-08-2004 02:19 AM

I have to use console.
Which is the library that provides console graphic functions? Xlib?

jinksys 07-08-2004 04:32 AM

There are two types of consoles, the virtual consoles that you access via the ALT-F keys, and the XWindows emulated terminals, such as xterm and konsole. the emulated terminals
cant do graphics, since console graphics are done through the framebuffer, which only the virtual terminals can use. So you arent using any kind of graphics interface at all?

pippet 07-08-2004 04:53 AM

i do use graphic interface. To be frank i don't know much abot Xserver.
I just want to implment the line drawing alogs by setting pixels (like we do in dos)
Please tell me if i can access that level of functions if i do programming for XWindows.

jinksys 07-08-2004 06:36 AM

Dos and linux are very different, in Dos there is no memory protection so C functions can
access the video memory and bios screen functions directly. You cant do that with linux,
and its by design. The simplest answer would be for you to invest in learning SDL, it is a
cross platform library for graphics, sound, input, and (maybe network?), although you are
only interested in the graphics dept. SDL supports most mediums, whether it be console,
a window, etc. and its real simple to setup and use. www.libsdl.org

Followup:
from the SDL website:
"... Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer."

nope, no network :) but that doesnt mean you cant implement network via sockets.

The_Nerd 07-08-2004 01:10 PM

Quote:

Originally posted by jinksys
nope, no network :) but that doesnt mean you cant implement network via sockets.
I don't know why people always say this. Its not true. SDL DOES have networking. Check this out:
http://www.libsdl.org/libraries.php?...Net&perpage=50



Anyhow, you might want to look into Allegro pippet: http://www.talula.demon.co.uk/allegro/

I think it will allow you to access video memory (though not directly) even if the X server isn't running. SDL may be better. SDL is definitly better if you plan to do serious 3D or something similar. Allegro is probably better for 2D though. SDL + OpenGL-2D may be the best.

jinksys 07-08-2004 08:17 PM

Quote:

Originally posted by The_Nerd
I don't know why people always say this. Its not true. SDL DOES have networking. Check this out:
http://www.libsdl.org/libraries.php?...Net&perpage=50

I really just meant the actual sdl library itself.

pippet 07-09-2004 05:20 AM

thank u all .
i am working on SDL
Will be back with more questions, expecting u all.


All times are GMT -5. The time now is 12:08 AM.