LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Graphic progamming under Linux (https://www.linuxquestions.org/questions/programming-9/graphic-progamming-under-linux-93283/)

so_o 09-16-2003 01:16 AM

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.

Xiangbuilder 09-16-2003 02:12 AM

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.

josedsilva 09-16-2003 04:16 AM

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

kev82 09-16-2003 05:20 AM

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.

dogn00dles 09-16-2003 05:28 AM

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.

so_o 09-16-2003 09:02 AM

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...

jinksys 09-16-2003 04:49 PM

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.

jinksys 09-16-2003 04:50 PM

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.

kev82 09-16-2003 06:01 PM

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.

jinksys 09-16-2003 06:38 PM

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.


All times are GMT -5. The time now is 03:51 AM.