SDL-mirror/src
Sam Lantinga ba096ad053 Date: Sun, 22 Mar 2009 12:52:29 +0000
From: Luke Benstead
Subject: OpenGL 3.0 Context Creation

I've attached a patch which implements OpenGL 3.x context creation on
the latest SVN. I've added two options to SDL_GL_SetAttribute, these
are SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION.
These default to 2 and 1 respectively. If the major version is less
than 3 then the current context creation method is used, otherwise the
appropriate new context creation function is called (depending on the
platform).

Sample code:

    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
        printf("Unable to initialize SDL: %s\n", SDL_GetError());
        return 1;
    }

    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); //Without these 2 lines, SDL will create a GL 2.x context
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

    SDL_Surface* screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL | SDL_FULLSCREEN );


I've implemented context creation on both Win32 and X and run basic
tests on both. This patch doesn't provide access to all the options
allowed by the new context creation (e.g. shared contexts, forward
compatible contexts) but they can be added pretty easily.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403567
2009-03-24 10:43:53 +00:00
..
audio Date: Mon, 23 Mar 2009 09:17:24 +0200 2009-03-24 10:33:12 +00:00
cdrom Fixed some dependency issues with SDL_revision.h 2009-01-04 05:52:14 +00:00
cpuinfo Fixed some dependency issues with SDL_revision.h 2009-01-04 05:41:52 +00:00
events Fixed bug #684 2009-02-17 05:59:40 +00:00
file Updated copyright date 2008-12-08 00:27:32 +00:00
haptic More verbosity and error checking. 2009-02-21 18:03:22 +00:00
joystick Fixed potential double-free crash 2009-03-06 05:53:33 +00:00
libm Fixed Visual C++ release build for Visual C++ 2005 2009-01-10 18:32:24 +00:00
loadso Reverted Bob's indent checkin 2009-01-10 21:50:26 +00:00
main Updated copyright date 2008-12-08 00:27:32 +00:00
stdlib Updated copyright date 2008-12-08 00:27:32 +00:00
thread indent 2009-02-17 05:57:54 +00:00
timer Updated copyright date 2008-12-08 00:27:32 +00:00
video Date: Sun, 22 Mar 2009 12:52:29 +0000 2009-03-24 10:43:53 +00:00
SDL.c Added missing void 2009-01-04 23:36:53 +00:00
SDL_compat.c Date: Thu, 05 Feb 2009 17:27:54 +0100 2009-03-23 05:37:45 +00:00
SDL_error.c Reverted Bob's indent checkin 2009-01-10 21:50:26 +00:00
SDL_error_c.h Updated copyright date 2008-12-08 00:27:32 +00:00
SDL_fatal.c Fixed some dependency issues with SDL_revision.h 2009-01-04 05:41:52 +00:00
SDL_fatal.h Updated copyright date 2008-12-08 00:27:32 +00:00