GL3 context creation patch for SDL-1.2.13

Hello all,

Attached is a diff created with

diff -ur src/ …/SDL-1.2.13/src/ > …/SDL-1.2.13-GL3.diff

to be applied agaisnt vanilla SDL-1.2.13 as extracted from SDL-1.2.13.tar.gz
on libsdl.org; the patch adds:

  1. GL3+ context creation for MSWindows
  2. GL3+ context creation for X-Windows

mirroring the API that was done for GL3 context creation
for SDL-1.3 that was posted a while ago by Luke Benstead
(and subsequently added to SDL-1.3 repository)
the following have been added for setting if and
how to create a GL3 context:

SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, desired_major);
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, desired_major);

additionally one can set (some) of the bit field flags for GL3 context
creation via

SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, desired_flags);

where desired flags comes from the bitfields added to SDL_video.h:

SDL_GL_CONTEXT_DEBUG_BIT
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_BIT

the enums:
SDL_GL_CONTEXT_MAJOR_VERSION,
SDL_GL_CONTEXT_MINOR_VERSION,
SDL_GL_CONTEXT_FLAGS
where added to SDL_video.h’s typedef enum SDL_GLattr, at the
end of the enumeration.

an additional #define was added to SDL_video.h as well:

SDL_GL_NEW_CONTEXT_AWARE

Note: these bitfield values are NOT the same as the corrospinding
wglCreateContextAttribARB and glxCreateContextAttribARB calls.

The API entry entry point to specify the creation flags
is NOT in the SDL-1.3 patch, but I would bet quite a bit that
something like it will be added soon; if the patch for 1.3 does
not follow the API stated here, I will (eventually) mirror it with
another patch.

For testing, this patch appears to be binary and source
compatible with SDL-1.2.13. To reiterate, this is for SDL-1.2.13
for those are using SDL-1.2.13, not SDL-1.3.

Testing and comments welcome.

-Kevin Rogovin
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL-1.2.13-GL3.diff
Type: application/octet-stream
Size: 11678 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090403/fe0055bb/attachment.obj