PDA

View Full Version : OpenGL, SDL, graphics, games



Elisei
June 18th, 2007, 03:51 PM
hi;

wondering if someone could tell me whats a good way to learn graphics programming on Linux, like OpenGL, SDL and whatever else there is; i've got a few books for OpenGL but they are for windows, eventually it shouldn't matter of course but WinMain.cpp is not very Linux friendly;

thank for replies;

meatpan
June 18th, 2007, 04:26 PM
MIT open courseware has a great introduction to computer graphics:

http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-837Fall2003/CourseHome/index.htm

The class uses openGL.

moma
June 18th, 2007, 07:26 PM
This forum has a good list of OpenGL resources and samples. Have you checked http://ubuntuforums.org/showthread.php?t=333867#8 ?
Read also the Note 5) of this page (http://www.futuredesktop.org/codeblocks_on_ubuntu_9.04.html).
GLUT library (packages freeglut3 and freeglut3-dev) makes OpenGL graphics programming very easy in Linux. OpenGL and glut are multiplatform libraries!
-----------------------------------------------------------------------------------------

How to run the lessons?

Let's have an example:
a) Browse to http://nehe.gamedev.net website and move on to the "Lessons 01 - 05" page.

b) Then browse down to "Your First Polygon:" section and clik on the picture. It will take you to the code.
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=02
Read and study the explanation.

c) Then scroll down to the bottom of the page and click on the "DOWNLOAD Linux Code For This Lesson. ( Conversion by Richard Campbell )" link. It will download (most likely a GLUT based) code for Linux. There is also a special "GLUT" link but it is a GLUT sample for Windows. The difference is not so big but take the "Linux" code instead.

d) Create a "lesson2" directory, untar and put the files there.

e) Start gnome-terminal (menu selection: Applications -> Accessories -> Terminal) and cd into your lesson2 directory.
$ cd lesson2

f) Compile the sample code
$ make

g) Run it.
$ ./lesson2
------------------------

Notice: The above example requires GLUT Library (in Linux: freeglut3-dev (http://freeglut.sourceforge.net/) package) and OpenGL (which in Linux is the mesa (http://www.mesa3d.org/) packages).
Use the Synaptic Package Manager or run the following command on the command line and install freeglut3 and freeglut3-dev packages. All necessary packages are in your distro's package well (=repository).

$ sudo apt-get install freeglut3 freeglut3-dev

Other important packages
$ sudo apt-get install build-essential gdb subversion
$ sudo apt-get install automake autoconf libtool
$ sudo apt-get install libgtk2.0-dev libxmu-dev libxxf86vm-dev

vexorian
June 18th, 2007, 07:29 PM
Lovely link, thanks.

maddog39
June 19th, 2007, 05:04 AM
Here's a very very good beginning game programming tutorial series linked to on the libsdl.org website. Keep in mind though that SDL is 2D only but intergrates with OpenGL very well if you want to use them interchangably. But SDL tends to be much much easier to learn in understand. So heres the link, check it out:

http://lazyfoo.net/SDL_tutorials/index.php