View Single Post
Old 12-18-06, 03:58 PM   #8
lunix
Registered User
 
lunix's Avatar
 
Join Date: Jul 2002
Location: Vancouver
Posts: 69
Send a message via MSN to lunix
Default Re: setting up OpenGL in Linux.

Hi again. The nehe tutorials are a good and satisfying way to get started with opengl. GLUT is crossplatform however it is obvious that the glut version of lesson 02 was written for windows. There is not very much learning associated with the various ways of aquiring a GL context you may still wish to look into SDL it will save you some hassle getting the examples to compile

To get it to work in linux change the includes from:

#include <windows.h> // Standard Header For Most Programs
#include <gl/gl.h> // The GL Header File
#include <gl/glut.h> // The GL Utility Toolkit (Glut) Header

To:

#include <stdlib.h> // defines exit
#include <GL/gl.h> // The GL Header File
#include <GL/glut.h> // The GL Utility Toolkit (Glut) Header

Then change the return type of "main" from void to int tsk-tsk.

Now simply compile like so:
$ g++ lesson2.cpp -lGL -lGLU -lglut
And run like so:
$ ./a.out

tada
__________________
Gentoo
lunix is offline   Reply With Quote