OpenGL in SDL on Ubuntu

Supposedly SDL is better supported than GLUT for cross-platform OpenGL. There's even a Nintendo DS and Wii port for it!

SDL is right in the Ubuntu repository, so it is just as easy to install as GLUT was:
sudo aptitude install libsdl-dev

To test it out, this time I went to NeHe Lesson 2. There is a port for Linux/SDL.

The same GL header files are needed, but this time SDL is needed as well:
#include <GL/gl.h>
#include <GL/glu.h>
#include "SDL.h"

It looks like there are a couple more flags needed, the part at the end is SDL, I'm not sure why it looks that way.
gcc lesson02.c -lGL -lGLU `sdl-config --cflags --libs`


Post a Comment