docs/README-cmake.md
author Sam Lantinga <slouken@libsdl.org>
Wed, 18 Oct 2017 08:52:04 -0700
changeset 11630 ad4b5d85edee
parent 10486 5bf595c48fd4
child 13087 76ff33e9a6b4
permissions -rw-r--r--
Fixed bug 3821 - Allow SDL_CreateWindow and SDL_CreateRenderer with OpenGL ES 3.0 (GLES3) for Angle (Windows)

Carlos

Angle supports GLES3 but when using these functions (SDL_CreateWindow and SDL_CreateRenderer), defaults again to GLES2.0.

A current workaround (hack) to retrieve a GLES3.0 context with Angle is:

1) set

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);

after InitSDL AND after calling SDL_CreateWindow (before SDL_CreateRenderer)

2) Comment lines 2032-2044 in SDL_render_gles2.c, funtion GLES2_CreateRenderer

window_flags = SDL_GetWindowFlags(window);
if (!(window_flags & SDL_WINDOW_OPENGL) ||
profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) {

changed_window = SDL_TRUE;
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR);

if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) {
goto error;
}
}

This retrives a GLES3 context as confirmed using glGetString(GL_VERSION). This should be fixed by modifying a few if's.
slouken@10486
     1
CMake
gabomdq@9023
     2
================================================================================
slouken@10486
     3
(www.cmake.org)
gabomdq@9023
     4
gabomdq@9023
     5
SDL's build system was traditionally based on autotools. Over time, this
gabomdq@9023
     6
approach has suffered from several issues across the different supported 
gabomdq@9023
     7
platforms.
gabomdq@9023
     8
To solve these problems, a new build system based on CMake is under development.
gabomdq@9023
     9
It works in parallel to the legacy system, so users can experiment with it
gabomdq@9023
    10
without complication.
gabomdq@9023
    11
While still experimental, the build system should be usable on the following
gabomdq@9023
    12
platforms:
philipp@9066
    13
philipp@9066
    14
* FreeBSD
philipp@9066
    15
* Linux
philipp@9066
    16
* VS.NET 2010
philipp@9066
    17
* MinGW and Msys
philipp@9066
    18
* OS X with support for XCode
philipp@9066
    19
philipp@9066
    20
gabomdq@9023
    21
================================================================================
gabomdq@9023
    22
Usage
gabomdq@9023
    23
================================================================================
gabomdq@9023
    24
gabomdq@9023
    25
Assuming the source for SDL is located at ~/sdl
gabomdq@9023
    26
philipp@9066
    27
    cd ~
philipp@9066
    28
    mkdir build
philipp@9066
    29
    cd build
philipp@9066
    30
    cmake ../sdl
gabomdq@9023
    31
gabomdq@9023
    32
This will build the static and dynamic versions of SDL in the ~/build directory.