Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ endif()
# Platform specific files builds
file(GLOB PLATFORM_SOURCES src/${PLATFORM}/*.c)

# OpenGL ES 2.0 / WebGL2 compatibility
option(ENABLE_GLES2 "Build the gl_renderer against OpenGL ES 2.0 / WebGL 1.0 instead of desktop GL 4.1 Core" OFF)
if (ENABLE_GLES2 AND ENABLE_LEGACY_GL)
set(ENABLE_LEGACY_GL OFF)
endif()

# OpenGL ES 3.0 / WebGL2 compatibility
option(ENABLE_GLES "Build the gl_renderer against OpenGL ES 3.0 / WebGL2 instead of desktop GL 4.1 Core" OFF)
if (ENABLE_GLES AND ENABLE_LEGACY_GL)
Expand Down
6 changes: 4 additions & 2 deletions src/desktop/backends/glfw2.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ bool platformInit(int32_t reqW, int32_t reqH, const char *title, bool headless)
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 1);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 1);
} else {
#ifdef ENABLE_GLES
#if defined(ENABLE_GLES2) || defined(ENABLE_GLES)
glfwOpenWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
#ifdef ENABLE_GLES2
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 2);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 0);
#else
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
#endif
glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwOpenWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
Expand Down
6 changes: 5 additions & 1 deletion src/desktop/backends/glfw3.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ bool platformInit(int32_t reqW, int32_t reqH, const char *title, bool headless)
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
} else {
#ifdef ENABLE_GLES
#if defined(ENABLE_GLES2) || defined(ENABLE_GLES)
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
#ifdef ENABLE_GLES2
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
#else
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
#endif
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
#else
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
Expand Down
6 changes: 5 additions & 1 deletion src/desktop/backends/sdl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,15 @@ bool platformInit(int reqW, int reqH, const char *title, bool headless) {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
} else if (gfx == MODERN_GL) {
#ifdef ENABLE_GLES
#if defined(ENABLE_GLES2) || defined(ENABLE_GLES)
#ifdef SDL_GL_CONTEXT_PROFILE_MASK
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
#endif
#if defined(ENABLE_GLES2)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
#elif defined(ENABLE_GLES)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
#endif
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
#else
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
Expand Down
Loading
Loading