Installing freeglut and OpenGl

This is a simple tutorial to show a new linux user (such as myself) how to setup freeglut and OpenGl. 

System used IBM T22 ThinkPad: 
mobile pentium 3 900mhz
256mb ram 
20GB hd 
S3 Inc. 86C270-294 Savage/IX-MV (rev 13) video card

OS: xubuntu 6.10

I have just recently become a linux user and wanted to install freeglut to do my graphics assignments on my laptop. Although the install did not turn out to be very difficult it took me a while to do. So I have written this tutorial in case another young linux user comes along and decides he/she wants to install freeglut and OpenGL.

**This tutorial assumes that you have your operating system installed and you have access to the internet** 

Steps:

From a terminal

1) sudo apt-get update 

-This will update your apt database to the most recent available packages.

2) sudo apt-get install build-essential

- This installs the necessary development tools for building source code.

3) sudo apt-get install freeglut3-dev

- This installs the development libraries and headers for freeglut.

Your done! Extremely simple! However you must remember that when compiling you must add a '-lglut' as a comand line argument to gcc. If you don't it cannot find the library's and you will get undefined reference errors.

example command line: gcc simple.c -lglut

At this point if your program compiles and runs then you are finished. However the first time I tried to run mine I received a 'libGL warning: 3D driver claims to not support visual 0x42'. This error means I cannot display the required colors to run the program. In my case I had the most recent drivers for my video card. So I did some research on my monitor and found out it can display a color depth of 24 instead of the 16 it was set at. To fix this problem you must edit the /etc/X11/xorg.conf file as root and set the 'DefaultDepth 24'. Reboot and the problem is solved.

This is my first post (and tutorial) on the ubuntuforums. If people feel that this tutorial is not needed they can feel free to remove it. If anyone wants to add anything related to freeglut or OpenGl please feel free.

你可能感兴趣的:(Installing freeglut and OpenGl)