Android.mk
author Sam Lantinga <slouken@libsdl.org>
Wed, 18 Oct 2017 08:52:04 -0700
changeset 11630 ad4b5d85edee
parent 11534 30c06adff2c3
child 11702 cf166abbde4a
permissions -rwxr-xr-x
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.
     1 LOCAL_PATH := $(call my-dir)
     2 
     3 ###########################
     4 #
     5 # SDL shared library
     6 #
     7 ###########################
     8 
     9 include $(CLEAR_VARS)
    10 
    11 LOCAL_MODULE := SDL2
    12 
    13 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
    14 
    15 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
    16 
    17 LOCAL_SRC_FILES := \
    18 	$(subst $(LOCAL_PATH)/,, \
    19 	$(wildcard $(LOCAL_PATH)/src/*.c) \
    20 	$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
    21 	$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
    22 	$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
    23 	$(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \
    24 	$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
    25 	$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
    26 	$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
    27 	$(wildcard $(LOCAL_PATH)/src/dynapi/*.c) \
    28 	$(wildcard $(LOCAL_PATH)/src/events/*.c) \
    29 	$(wildcard $(LOCAL_PATH)/src/file/*.c) \
    30 	$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
    31 	$(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \
    32 	$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
    33 	$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
    34 	$(LOCAL_PATH)/src/joystick/steam/SDL_steamcontroller.c \
    35 	$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
    36 	$(wildcard $(LOCAL_PATH)/src/power/*.c) \
    37 	$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
    38 	$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
    39 	$(wildcard $(LOCAL_PATH)/src/render/*.c) \
    40 	$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
    41 	$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
    42 	$(wildcard $(LOCAL_PATH)/src/thread/*.c) \
    43 	$(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
    44 	$(wildcard $(LOCAL_PATH)/src/timer/*.c) \
    45 	$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
    46 	$(wildcard $(LOCAL_PATH)/src/video/*.c) \
    47 	$(wildcard $(LOCAL_PATH)/src/video/android/*.c) \
    48 	$(wildcard $(LOCAL_PATH)/src/test/*.c))
    49 
    50 LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
    51 LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
    52 
    53 include $(BUILD_SHARED_LIBRARY)
    54 
    55 ###########################
    56 #
    57 # SDL static library
    58 #
    59 ###########################
    60 
    61 LOCAL_MODULE := SDL2_static
    62 
    63 LOCAL_MODULE_FILENAME := libSDL2
    64 
    65 LOCAL_LDLIBS := 
    66 LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
    67 
    68 include $(BUILD_STATIC_LIBRARY)
    69 
    70 ###########################
    71 #
    72 # SDL main static library
    73 #
    74 ###########################
    75 
    76 include $(CLEAR_VARS)
    77 
    78 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
    79 
    80 LOCAL_MODULE := SDL2_main
    81 
    82 LOCAL_MODULE_FILENAME := libSDL2main
    83 
    84 include $(BUILD_STATIC_LIBRARY)
    85 
    86