ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.