Skip to content

EGL context is not created on Android #3521

@deveee

Description

@deveee

Prerequisite Checklist

Describe your issue here

I'm trying to make SFML port for MultiCraft. Currently it works fine on Linux, however I have some issues when trying to make it working on Android.

It looks that EGL context is not created. Then it fails to compile shaders and crashes on some opengl related functions (on MultiCraft side).

From logcat:

[2025-06-02 21:44:39.554 Uid(value=10560):4698:4698 W/libEGL]
Couldn't find an OpenGL ES implementation from
[2025-06-02 21:44:39.571 Uid(value=10560):4698:4698 E/libEGL]
validate_display:559 error 3001 (EGL_NOT_INITIALIZED)

and later

[2025-06-01 00:43:15.684 Uid(value=10558):7350:7398 E/libEGL]
call to OpenGL ES API with no current context (logged once per thread)
[2025-06-01 00:43:15.684 Uid(value=10558):7350:7398 I/sfml-error]
Warning: The created OpenGL context does not fully meet the settings that were requested
[2025-06-01 00:43:15.684 Uid(value=10558):7350:7398 I/sfml-error]
Requested: version = 3.0 ; depth bits = 24 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
[2025-06-01 00:43:15.684 Uid(value=10558):7350:7398 I/sfml-error]
Created: version = 0.0 ; depth bits = 24 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
[2025-06-01 00:43:15.684 Uid(value=10558):7350:7398 I/sfml-error]
Failed to activate the window's context

You can find the SFML port here
https://github.com/deveee/Irrlicht/tree/SFML
https://github.com/deveee/MultiCraft/tree/SFML
https://github.com/deveee/deps_android/tree/SFML

The most relevant part is
https://github.com/deveee/Irrlicht/blob/SFML/source/Irrlicht/CIrrDeviceSFML.cpp
and the Android project
https://github.com/deveee/MultiCraft/tree/SFML/Android

Also note that we use custom native activity, maybe it matters
https://github.com/deveee/MultiCraft/blob/SFML/Android/app/src/main/java/com/multicraft/game/GameActivity.kt

It fails to start on several different phones, so it's not a bug in system/drivers. I tried gles1, using RenderWindow, different context creation settings, shared/static linking etc. and it seems that it is unrelated.

Any idea what can be wrong? Tbh. I'm not sure if I missed something or if it's a problem with SFML EGL context creation.

Your Environment

  • OS / distro / window manager: Android
  • SFML version: 3.0.1
  • Compiler / toolchain:
  • Special compiler / CMake flags:

Steps to reproduce

Build and run the game.

Expected behavior

Game runs.

Actual behavior

Game doesn't run.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions