🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Linux and graphics

Started by
6 comments, last by Jesava 23 years, 8 months ago
Hi, I would like to start making some graphic demos for Linux but I can''t seem to find any information/tutorials on how to open up a graphics mode and plot a pixel. Thing is I don''t want to use any libraries like SDL or SVGALib. I want to do it myself from scratch just like in the old DOS days where you called interrupts etc. Can anyone help me?!
Advertisement
I don''t know if Linux has interrupts like DOS does; I think everything draws directly to the card at the lowest level. But I could be wrong. Why don''t you want to use any libraries?


"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away"--Henry David Thoreau
Yeah, you CAN do that. I don''t remember how, but i know you can.

This seems to be a perenial question around here. I even understand the desire to not use any libraries, but you should recognize the reason that this is NOT a good idea on Linux.

Assuming you''re migrating from another OS, you really have nothing new to learn by using direct pixel manipulations. I do think that this is a good place for beginner programmers to start, but assuming you''re not a beginning programmer, you have all the theoretical background you need, and slipping into a new library shouldn''t be too diffecult.

Ok, so why SHOULDN''T you plot pixels on the video card? Well, because in a secure system, direct hardware access is a no-no for obvious reasons. So, instead of having to make every game SUID root (which should make you shudder if you care about the security or stability of your system), many people use a library which uses serves that CAN talk to the hardware, and just do things like make sure you don''t screw anything up, and while they''re at it, often add abstracted support for nice things like hardware acceleration and stuff like that. So, you can still plot pixels, but you''ll be doing so through some library.

Having said all that, if you still want to write some programs just to learn how to plot pixels on the hardware under Linux, there are places that''ll tell you, but don''t even think about making a Linux game that requires SUID root unless there''s a DAMN good reason if you want people to play it.

-benc
The thing is I don''t find any information about how to write your own graphics library for Linux. I have looked thru the source for SVGALib and they use interrupts and stuff just like in the old DOS days. But I can''t learn anything from the source and I don''t want to copy/paste.
quote: Original post by Jesava

The thing is I don''t find any information about how to write your own graphics library for Linux. I have looked thru the source for SVGALib and they use interrupts and stuff just like in the old DOS days. But I can''t learn anything from the source and I don''t want to copy/paste.



I think this is cuss the interrupts and basic screen I/O are defined by the BIOS & _not_ the OS. So you should still beable to use mode 13h in the same kind''a way, but remember that memory is managed in a differant way with Linux (so you may have problems chane-4 etc.).....
Try Learning X Windows here is a online book all though it''s little complex.
http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/XLib_PG/@Generic__BookTextView;hf=0;cs=fullhtml;pt=2;lang=he
0 error(s), 0 warning(s)
Most Linux games now are written using X11, much
like Windows Linux/X prefers to be `GUIly graphical'' when
it comes to graphics.

Take a look at XLib, the X11 (X Windows Systems) language.
It supports an object called XImage which is a client
side maintained graphics buffer that you can manipulate
directly.

Here''s a list of XLib functions:

http://freud.et.tudelft.nl/~marc/xlib/

I''m afraid I haven''t found a good XLib tutorial though,
if you are serious about this though, write back.
Tara Milana - WP Entertainmenthttp://wolfpack.twu.net/Comp graphics artist and programmer.
There''s a book being published by Prima next March called Linux Game Programming (written by Mark Collins *grin*) which includes a very easy to follow tutorial on Xlib programming.

Put money in my pockets ppl, PRE ORDER!

After careful deliberation, I have come to the conclusion that Nazrix is not cool. I am sorry for any inconvienience my previous mistake may have caused. We now return you to the original programming

This topic is closed to new replies.

Advertisement