Using Mesa with SDL

I’m having some trouble getting Mesa to work with SDL under X11.

I recently purchased an nvidia video card, when I use the nvidia X 

driver and nvidia supplied glx library, things work great - except the
nvidia driver causes X to xcrash every so often. Ok. While I’m working
this problem out, I thought, I’ll just use Mesa for software GL.

However, I can't seem to get SDL to load the Mesa library properly. 

What X modules need to be in place for this to work?
When I stop using the nvidia driver and use the vesa X11 driver, and
change my LD_LIBRARY_PATH to the directory with the Mesa libraries,
starting the applications that before worked under nvidia’s driver now
produce the message:

Could not set video mode: X11 driver not configured with OpenGL

When I looked up this error, the only thing I found was that this 

occurs when SDL is not compiled with -enable-video-opengl=yes. But this
is impossible, since my version does have that option set, and moreover
the same SDL library build ran the application when the nvidia driver
was present.

Any ideas?