Below is some example code to get you started quickly. If you are brave enough you can also take a look at last years entries.

src2004-2.zip contains the updated examples shown below and a simple makefile which should work on gnu/linux and with mingw32. Also included are some makefiles and other files needed to build on Mac OSX.

Please let me know ASAP if you find a mistake/bug/etc.. in these examples.

→ g.h

#include "SDL.h"
#include "SDL_opengl.h"
#include <math.h>
#include <stdlib.h>

→ s.h

#include "SDL.h"
#include <math.h>
#include <stdlib.h>

→ opengl example

#include "g.h"

int
main (int c, char **a)
{
  SDL_Event e;
        
  SDL_Init(32);
  SDL_SetVideoMode(640, 480, 32, 2);

  while (!SDL_PollEvent (&e) || e.type!=2)
    {
      glClear (65<<8);

      glColor3d (1, 0.5, 0);
      glRectf (-1, -1, 1, 1); 

      SDL_GL_SwapBuffers ();
    }
}

→ sdl example

#include "s.h"

int
main (int c, char **a)
{
  int x, y, p, w = 640, h = 480, *v;

  SDL_Surface * b;
  SDL_Event e;

  SDL_Init(32);
  b = SDL_SetVideoMode(w, h, 32, 0);
  v = b->pixels;
  p = b->pitch/4;

  while (!SDL_PollEvent (&e) || e.type!=2)
    {
      SDL_LockSurface (b);

      for (y=0; y<h; y++)
        for (x=0; x<w; x++)
          v[y*p+x] = 0xFF8000;

      SDL_UnlockSurface (b);
      SDL_Flip (b);
    }
}