Great evil required to change GL libs

I’m about to go to bed, however I may not remember when I wake up, so…

The setting goes like this, I have a functional GL context through SDL
that works, however I wish to support some reloading of the context for
a few reasons.

One thing I wish to support is the ability to change which GL lib we are
using, so the pattern goes like this.

SDL_GL_LoadLibrary (name);
SDL_GL_SetAttribute (…);
SDL_SetVideoMode (vid.width, vid.height, vid.bpp, SDL_OPENGL);

(Yes, the actual code is doing error checking.)
At this point all hell breaks loose, and either in SDL_SetVideoMode or
in later OpenGL calls (and yes, I /am/ remembering to reget all the
function pointers) the libGL segfaults messily.

After some thought, some discussion on #sdl, and some source diving, I
came up with a solution which works, but which is rather evil.

SDL_SetVideoMode (vid.width, vid.height, vid.bpp, 0);
SDL_InitSubSystem (SDL_INIT_VIDEO); // Quietly discarded.
SDL_GL_LoadLibrary (name);
SDL_GL_SetAttribute (…);
SDL_SetVideoMode (vid.width, vid.height, vid.bpp, SDL_OPENGL);

This is quite obviously exceedingly sick, and though it does work, I
want to avoid using it, if possible.

Now for the big question, how? Is this evil really needed just to make
this work?

Zephaniah E. Hull.–
1024D/E65A7801 Zephaniah E. Hull <@Zephaniah_E_Hull>
92ED 94E4 B1E6 3624 226D 5727 4453 008B E65A 7801
CCs of replies from mailing lists are requested.

It’s also your right to f*ck up your own version of Linux, but you’re
not getting close to mine.


-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available