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 |
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. |
I have to use console.
Which is the library that provides console graphic functions? Xlib? |
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? |
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. |
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. |
Quote:
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. |
Quote:
|
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. |