Hello,
I use SFML 3 on Android iwth ndk26
All I see is a black screen on an app that used to be fine in SFML 2.6
In logs, there are some errors:
Just once:
03-09 13:59:04.560 29307 29351 E libEGL : call to OpenGL ES API with no current context (logged once per thread)
03-09 13:59:04.560 29307 29351 I sfml-error: Warning: The created OpenGL context does not fully meet the settings that were requested
03-09 13:59:04.560 29307 29351 I sfml-error: Requested: version = 1.1 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
03-09 13:59:04.560 29307 29351 I sfml-error: Created: version = 0.0 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
03-09 13:59:04.560 29307 29351 I sfml-error: Failed to activate the window's context
03-09 13:59:04.560 29307 29351 I sfml-error: Failed to activate the window's context
03-09 13:59:04.560 29307 29351 I sfml-error: Failed to set window as active during initialization
03-09 13:59:04.569 29307 29351 I sfml-error: Failed to activate the window's context
Then multiple times:
03-09 13:59:04.803 29307 29351 I sfml-error: An internal OpenGL call failed in "RenderTarget.cpp"(1088).
03-09 13:59:04.803 29307 29351 I sfml-error: Expression:
03-09 13:59:04.803 29307 29351 I sfml-error: glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount))
03-09 13:59:04.803 29307 29351 I sfml-error: Error description:
03-09 13:59:04.803 29307 29351 I sfml-error: GL_INVALID_FRAMEBUFFER_OPERATION
03-09 13:59:04.803 29307 29351 I sfml-error: The object bound to FRAMEBUFFER_BINDING is not "framebuffer complete".
03-09 13:59:04.803 29307 29351 I sfml-error:
I use the famous TGUI lib for the GUI, Im not sure whether the problem could come from the underlying sfml calls (I think it's just calling drawVertexArray)
I also had a crash on the RenderTexture resize method:
03-09 13:59:11.351 29415 29415 F DEBUG : backtrace:
03-09 13:59:11.351 29415 29415 F DEBUG : #00 pc ffb98027e9f94015 <unknown>
03-09 13:59:11.351 29415 29415 F DEBUG : #01 pc 00000000000e2004 /data/app/~~mQVWED31JEDG77rm9QaZNQ==/com.you.fc2-cenX4YkRloTjCjrh9dih3Q==/lib/arm64/libsfml-graphics-d.so (sf::RenderTarget::initialize()+72) (BuildId: b263b7b841c29024d7bb89e56e586e1fc4ceb0bb)
03-09 13:59:11.351 29415 29415 F DEBUG : #02 pc 00000000000dc36c /data/app/~~mQVWED31JEDG77rm9QaZNQ==/com.you.fc2-cenX4YkRloTjCjrh9dih3Q==/lib/arm64/libsfml-graphics-d.so (sf::RenderTexture::resize(sf::Vector2<unsigned int>, sf::ContextSettings const&)+316) (BuildId: b263b7b841c29024d7bb89e56e586e1fc4ceb0bb)
03-09 13:59:11.351 29415 29415 F DEBUG : #03 pc 0000000001a881e0 /data/app/~~mQVWED31JEDG77rm9QaZNQ==/com.you.fc2-cenX4YkRloTjCjrh9dih3Q==/lib/arm64/libfc.so (SceneBase::loadVariables()+468) (BuildId: 83b20fc23894a7b431d415d6c1fc0241a8ce75a5)
This is how I built and installed SFML and TGUI:
downloadPath="$PWD/external_deps"
mkdir -p "$downloadPath"
cd "$downloadPath" || exit 1
ndkPath="/home/me/Desktop/dev/libs/android/android-ndk-r26d"
#-----------------------------------------------------------------------------------------------
# cd /home/me/Desktop/dev/libs/SFML_fork_gles2 || exit 1
cd /home/me/Desktop/dev/FactoryCapi/client/external_deps/SFML || exit 1
mkdir -p build_android
cd build_android || exit 1
SFML_build_android="$PWD"
cmake -S .. -DBUILD_SHARED_LIBS=ON -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="$ndkPath" -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release
cmake --build . --target all
cmake --install .
#-----------------------------------------------------------------------------------------------
cd $downloadPath/TGUI || exit 1
mkdir -p build_android
cd build_android || exit 1
cmake -S .. -DTGUI_BACKEND=SFML_GRAPHICS -DBUILD_SHARED_LIBS=ON -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="$ndkPath" -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release
cmake --build .
cmake --install .
Do you see any mistake here ? If not, I'll investigate further in my codebase
Thank you