SFML community forums
Help => Graphics => Topic started by: Nafffen on March 09, 2025, 02:32:27 pm
-
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
-
Is this the official SFML code base or are you using some GLES2 fork? Make sure you don't reference any headers of some fork anymore.
Can you try a minimal example, e.g. just a window and some circle or similar?
And/or post the code that causes issue?
From the error it seems that the OpenGL context creation fails. All the other errors are just follow up errors from that.
-
Indeed there were a mismatch in libs, now it is rendering properly, thank you.
however, I still have these error messages:
03-10 18:45:52.361 18671 18722 E libEGL : call to OpenGL ES API with no current context (logged once per thread)
03-10 18:45:52.362 18671 18722 I sfml-error: Warning: The created OpenGL context does not fully meet the settings that were requested
03-10 18:45:52.362 18671 18722 I sfml-error: Requested: version = 1.1 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
03-10 18:45:52.362 18671 18722 I sfml-error: Created: version = 0.0 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
03-10 18:45:52.362 18671 18722 I sfml-error: Failed to activate the window's context
03-10 18:45:52.362 18671 18722 I sfml-error: Failed to activate the window's context
03-10 18:45:52.362 18671 18722 I sfml-error: Failed to set window as active during initialization
03-10 18:45:52.373 18671 18722 I sfml-error: Failed to activate the window's context
I remember already having them in previous version.
I don't think I wrongly init my render window
m_renderWindow(sf::VideoMode::getFullscreenModes()[0], "name", sf::State::Fullscreen)
-
Are you doing this at a global scope or in a separate thread?
-
Same error with the example code:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode({200, 200}), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
while (const std::optional event = window.pollEvent())
{
if (event->is<sf::Event::Closed>())
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
}
03-11 18:38:57.821 29379 29463 E libEGL : call to OpenGL ES API with no current context (logged once per thread)
03-11 18:38:57.821 29379 29463 I sfml-error: Warning: The created OpenGL context does not fully meet the settings that were requested
03-11 18:38:57.822 29379 29463 I sfml-error: Requested: version = 1.1 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
03-11 18:38:57.822 29379 29463 I sfml-error: Created: version = 0.0 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
03-11 18:38:57.822 29379 29463 I sfml-error: Failed to activate the window's context
03-11 18:38:57.822 29379 29463 I sfml-error: Failed to activate the window's context
03-11 18:38:57.822 29379 29463 I sfml-error: Failed to set window as active during initialization
Followed by this error message in loop
03-11 18:38:57.822 29379 29463 I sfml-error: Failed to activate the window's context
But everything is rendered normally