Source code - not directly oGL related

I was trying to browse through the source code of the Kernel and other applications such as QT’s sources. What I got was a bunch of headers that link to pre-compiled libraries. I could not find any c or CPP files. Looking at the source will help me learn a lot more - openGL and otherwise. I wanted to know exactly how X Server starts the graphics mode and the function calls it makes. Although not an OpenGL q, any help in this regard is greatly appreciated.



well, if you want to know more about how the X server works then you could try looking at at xfree (

what do you want to know? is it just to satisfy your curiosity, or is there a deeper question that could be better answered with “use function X”?


Typically, the source for the kernel is in /usr/src/kernelxxx.

For example, in my /usr/src/linux-2.4/kernel directory I have all the .c kernel files.

Hope that helps…

Also you don’t just generally browse the code of X or the kernel as they tend to be rather big and complicated. It would be wise to learn a bit about the way they’re structured and what you want to look for exactly, otherwise I hope they have linux boxes with internet connections at the local nut asylum…

PS: As john suggested you might be able to get some insight from technical papers(there are some about the kernel, and there should be some info on the internals of X11). Reading the sources should be the last thing to do.

Thanks everyone. Tried out the xfree site. Great one. I was just trying to know how the Xfree server initialises the graphics mode. Under DOS, it is done by calling int86() with the proper values in the registers. I was just wondering if it is done the same way on linux. But given the security feature which prevents me from accessing the video memory by issuing a segmentation fault error and absence of dos.h which has the int86() BIOS interrupt generator routine, i was trying to find out a way to access the CPU registers (without assembly) and generate a video interrupt to see if it works. That would allow me to do graphics from the console myself. I tried searching the net for this answer but could not get a useful one.

But as I discovered, I’ll definitely go nuts if I try to read the source files. They are too complicated. I’ll first read the X documentation and technical papers. In the meantime, if anyone has already done something similar before, do share it.

Thanx everyone once again and Regards.
Abhijeet. (

Well if you want to do graphics on the console then you just have to use the framebuffer device. I did that once using assembly(although i believe you should be able to do it in C, you just have to have access to /dev/fb) and there is some info on how to do that. I even still have the source. Also for console graphics something like the svgalib might be better to look into as the X server uses drivers specific to each card to get graphics(unless of course you’re running X on the framebuffer).

[This message has been edited by zen (edited 09-18-2003).]

Could u mail me the source if u still have it?

Thanx and regards.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.