mosra/magnum — pull request #41 by ArEnSc (2013-12-26 12:29:13+00:00)
Title: Issue # 35 

General Change.

if (Detect if platform is Mac OSX == true):
Try and use SDL to change opengl context to 3.2
Create the window

if create window fails:
return false

Create the context

if create context fails:
Try Legacy context
Delete old window through SDL
Try and use SDL to change opengl context to 2.1

Create the window

if create window fails:
return false

Create the context

if create context fails:
Delete old window through SDL
return false
else:
Do the Linux and Windows way of creating SDL Window and Context.

Test 1:
Check if Opengl 3.2 Context is activated.
Complete

Test 2:
Check if Opengl 3.2 Context fails, have Opengl 2.1 Context created.
Complete
Note:
Minor issue with small issue pertaining to an SDL bug.
"Context: unsupported OpenGL version 0"
Sometimes the context is created properly sometimes it does not create the context.

Test 3:
Check if default window and context creation.
Complete

SDL 2.0
Notes on the area of work

http://wiki.libsdl.org/SDL_GLprofile

This enumeration is used in conjunction with SDL_GL_SetAttribute and SDL_GL_CONTEXT_PROFILE_MASK. Although the name SDL_GL_CONTEXT_PROFILE_MASK implies that multiple flags can be OR'd together, the profiles are mutually exclusive, and SDL_GL_SetAttribute accepts at most one of them. Setting the SDL_GL_CONTEXT_PROFILE_MASK attribute to 0 leaves the choice of profile up to SDL. Should be used in conjunction with the SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION attributes, since OpenGL profiles are defined relative to a particular version of OpenGL. There is no way to distinguish between the common and common lite profiles of OpenGL ES versions 1.0 and 1.1.

http://wiki.libsdl.org/SDL_GLattr#OpenGL

While you can set most OpenGL attributes normally, the attributes listed above must be known before SDL creates the window that will be used with the OpenGL context. These attributes are set and read with SDL_GL_SetAttribute() and SDL_GL_GetAttribute().

In some cases, these attributes are minimum requests; the GL does not promise to give you exactly what you asked for. It's possible to ask for a 16-bit depth buffer and get a 24-bit one instead, for example, or to ask for no stencil buffer and still have one available. Context creation should fail if the GL can't provide your requested attributes at a minimum, but you should check to see exactly what you got.

Multisample anti-aliasing is a type of full screen anti-aliasing. Multipsampling defaults to off but can be turned on by setting SDL_GL_MULTISAMPLEBUFFERS to 1 and SDL_GL_MULTISAMPLESAMPLES to a value greater than 0. Typical values are 2 and 4.

SDL_GL_CONTEXT_PROFILE_MASK determines the type of context created, while both SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION determine which version. All three attributes must be set prior to creating the first window, and in general you can't change the value of SDL_GL_CONTEXT_PROFILE_MASK without first destroying all windows created with the previous setting.