LinuxQuestions.org
Visit Jeremy's Blog.
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 07-08-2004, 02:45 AM   #1
pippet
Member
 
Registered: May 2004
Posts: 67

Rep: Reputation: 15
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
 
Old 07-08-2004, 03:16 AM   #2
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
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.
 
Old 07-08-2004, 03:19 AM   #3
pippet
Member
 
Registered: May 2004
Posts: 67

Original Poster
Rep: Reputation: 15
I have to use console.
Which is the library that provides console graphic functions? Xlib?
 
Old 07-08-2004, 05:32 AM   #4
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
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?
 
Old 07-08-2004, 05:53 AM   #5
pippet
Member
 
Registered: May 2004
Posts: 67

Original Poster
Rep: Reputation: 15
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.
 
Old 07-08-2004, 07:36 AM   #6
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
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.

Last edited by jinksys; 07-08-2004 at 07:37 AM.
 
Old 07-08-2004, 02:10 PM   #7
The_Nerd
Member
 
Registered: Aug 2002
Distribution: Debian
Posts: 540

Rep: Reputation: 32
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.
 
Old 07-08-2004, 09:17 PM   #8
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
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.
 
Old 07-09-2004, 06:20 AM   #9
pippet
Member
 
Registered: May 2004
Posts: 67

Original Poster
Rep: Reputation: 15
thank u all .
i am working on SDL
Will be back with more questions, expecting u all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
graphics programming with gcc mamta_k Linux - Software 1 06-01-2004 08:28 AM
programming the mouse in a VESA graphic mode in Linux Zither Programming 5 03-18-2004 06:35 AM
gcc programming gazza Linux - Newbie 3 02-13-2004 02:21 AM
output in graphic mode with gcc Rex_chaos Programming 9 05-13-2002 10:56 AM
output in graphic mode with gcc Rex_chaos Linux - General 6 05-12-2002 04:53 AM

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

All times are GMT -5. The time now is 07:38 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration