LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-16-2003, 01:16 AM   #1
so_o
LQ Newbie
 
Registered: Sep 2003
Posts: 2

Rep: Reputation: 0
Question Graphic progamming under Linux


I'm a beginner in graphics programming under Linux platform.

I'm now learning Computational Graphics. And I want to build my own programme from scratches, say from putting a pixel on the screen. But since the course mainly focuses on the dos programming and it uses DOS INTerruption, I find it hard to transplant the codes into Linux platform. So can anyone help me ?

How can I draw a pixel under Linux console (not X windows) ?
It will be better if you can tell me how to perform the funcition of BIOS INT under linux.


Thanks a lot for reading and even more if you can be of help.
 
Old 09-16-2003, 02:12 AM   #2
Xiangbuilder
Member
 
Registered: Apr 2003
Location: Shandong province China
Distribution: fedora core 1.0
Posts: 206

Rep: Reputation: 30
I am a beginner too, I like palying GNU Go, that game can draw something in console, you can download its source code. maybe helpful.

Last edited by Xiangbuilder; 09-16-2003 at 06:29 AM.
 
Old 09-16-2003, 04:16 AM   #3
josedsilva
LQ Newbie
 
Registered: Apr 2002
Location: Goa, India.
Posts: 23

Rep: Reputation: 15
Try getting help on the curses library (libcurses). The C program header file is curses.h
You will also need to compile your program with the following switch:
-l curses
I'll get back to you when I get more info. on libcurses
 
Old 09-16-2003, 05:20 AM   #4
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
for the 30000000000000 time. BIOS interrupts are not available in protected mode, this means they can not be used in any of the following operating systems. linux, winnt 3.5, winnt 4.0, win2k, winxp, solaris(for x86 obviously), bsd, etc...

sorry but im just fed up of that question, i dont mean anything by it.

anyway, to do console graphics, you need to look into at least one of: svgalib, directfb, programming the framebuffer yourself, sdl. thats all i can think of at the moment, ncurses/curses isnt really what you want its character cell based not pixel based. whats wrong with X though? why do you need to do it in the console.
 
Old 09-16-2003, 05:28 AM   #5
dogn00dles
Member
 
Registered: Feb 2003
Distribution: Slack 9.0/NetBSD
Posts: 101

Rep: Reputation: 15
Try SVGA! I have really limited experience with it...there's a really good black book that tells you everything about it though..have fun.
 
Old 09-16-2003, 09:02 AM   #6
so_o
LQ Newbie
 
Registered: Sep 2003
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you for all your help. And I will try your methods and I think I can arrive at something in a weeks' time.

Maybe I will have even more questions then. So see you all then...

Thanks...
 
Old 09-16-2003, 04:49 PM   #7
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
Maybe I can answer your question, without so much aggression.
If you want to do graphics under a linux console, you'd be working with the frame buffer. The easiest way to interact with it would be using SDL. Keep in mind that the frame buffer only exists on linux's true consoles, not X terminals such as xterm or konsole. Keep in mind that svgaLib is dead and a horrible API. I have the "black book" for it and the only thing I learned from it was how to lock up my linux box with 3 lines of code. Hurray!(not).
So give SDL a try, you wont regret it.
 
Old 09-16-2003, 04:50 PM   #8
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
BTW, a great book to get would be "Programming Linux Games" by No starch press. i have it and its how i got my feet wet in SDL.
 
Old 09-16-2003, 06:01 PM   #9
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
i dont know anything about svgalib so jinksys is probably correct, ive never been a great fan of sdl myself, event handling was always really slow for me but many other people report it to work and i havnt tried for a long time. i would personally go with directly programming the framebuffer because all you need is open(), a few ioctl()'s and an mmap() and youve got exactly the same as you would have using int 0x10 so it would be easy to to write wrapper functions and you dont have to worry about any external libraries.

here is a guide to setting up a framebuffer but its not written for the C or linux newbie.
 
Old 09-16-2003, 06:38 PM   #10
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
If all you are gonna do is draw with pixels, and you are comfortable with "going in manually" then directly accessing the FB would be the way to go. But if you want to include your own graphic files, SDL provides mechanisms to easily import graphic files.
 
  


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
Graphic SSH Client in Linux chinaundead Linux - Newbie 23 01-30-2012 02:27 AM
a graphic card for Linux jaakkop Linux - Hardware 2 06-04-2005 07:47 AM
Graphic characters for Linux Console JLAlber Linux - General 0 04-20-2005 03:57 PM
Linux Graphic Terminals? PlatinumRik Linux - Networking 5 07-02-2003 11:28 AM
Graphic login in Solaris from Linux rsheissa Linux - General 24 02-04-2003 05:51 PM

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

All times are GMT -5. The time now is 02:59 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