Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Nafffen

Pages: [1] 2
1
Graphics / Re: SFML 3 and Android, full black screen and gl erros
« on: March 11, 2025, 06:42:40 pm »
Same error with the example code:
Code: [Select]
#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();
    }
}


Code: [Select]
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
Code: [Select]
03-11 18:38:57.822 29379 29463 I sfml-error: Failed to activate the window's context
But everything is rendered normally

2
Graphics / Re: SFML 3 and Android, full black screen and gl erros
« on: March 10, 2025, 07:22:33 pm »
Indeed there were a mismatch in libs, now it is rendering properly, thank you.

however, I still have these error messages:
Code: [Select]
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
Code: [Select]
m_renderWindow(sf::VideoMode::getFullscreenModes()[0], "name", sf::State::Fullscreen)

3
Graphics / SFML 3 and Android, full black screen and gl erros
« 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:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
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

4
I was not aware of that fork, it helped me a lot ! Thank you

5
Hey, I am playing a bit with sfml and opengl to learn some stuff. I am trying to use opengl es 2 instead of 1.
I started by regenerating the glad header with the same extentions but with open gl es 2 in addition.
I saw that you added prefix sf_ before almost every symbols and I wondered why ? Was that necessary ?
Also I am getting a linker error on a lot of function pointers. The first one glad_glGetError (I removed "sf_"). I dont really understand as gl.h should be header only and I can't find a big difference with your file.
Can you help me with that ?
Thank you

6
Graphics / Re: Clarification from the sprite tutorial
« on: April 17, 2024, 09:25:01 pm »
Very clear thank you very much !

7
Graphics / Re: Clarification from the sprite tutorial
« on: April 13, 2024, 11:19:26 pm »
Hey, thank you for your reply !
Just a following question, is the 'cost' of that texture change related to the size of the texture ?
For example, would it be more efficient to :
- have a big single texture for multiple objects but alternately used with other small textures (Big texture -> Small Texture -> Big Texture -> Small texture)
- have many small textures and alternately called them (Small Texture -> Small Texture -> Small Texture -> Small Texture -> ...)

8
Graphics / Clarification from the sprite tutorial
« on: March 31, 2024, 06:50:16 pm »
Hello,
Currently reading the tutorial about sprites and textures
https://www.sfml-dev.org/tutorials/2.5/graphics-sprite.php#the-importance-of-using-as-few-textures-as-possible
Quote
Using as few textures as possible is a good strategy, and the reason is simple: Changing the current texture is an expensive operation for the graphics card. Drawing many sprites that use the same texture will yield the best performance.
As far as I understand, it is not `setTexture` method of `sf::Sprite` that in expensive, it is the fact of drawing a sprite with a texture, then a sprite with another one.
Am I right ?
Thank you

9
General / Re: Final answer for async loading texture ?
« on: March 27, 2024, 11:14:23 am »
Perfect ! Thank you

10
General / Final answer for async loading texture ?
« on: March 25, 2024, 10:20:49 pm »
Hey,
I want to load textures while my application is still running (logic + rendering).
I have been looking for a clear answer and the best I could find was in this topic some years ago :
https://en.sfml-dev.org/forums/index.php?topic=20569.0
It's said it's not recommended. Is it the same in 2024 ?
I don't know much about OpenGL, I have seen topics about internal/external context but not really a clear answer.
What are the best practices ?
Thank you

11
Graphics / 2 questions about VertexArray / VertexBuffer
« on: December 21, 2023, 11:13:40 am »
1. With Primitives Triangles, is there a way to specify all points then specify index of points used for each triangles ? Or the API just allows passing triangles directly by coords ?

2. With other than Triangles, is there a way to "reset" the primitive, for example with sf::TriangleFan, start a new TriangleFan in another location, but they will be drawn from the same VertexArray

Thank you

12
Graphics / few questions about VertexBuffer on Android
« on: December 06, 2023, 10:08:26 am »
I know PrimitiveType::Quad is deprecated with OpenGL ES, what about the others ? Is everything else ok on Android ?

How many vertices do you think an average phone can handle per draw call if I use sf::VertexBuffer(sf::Triangles, sf::VertexBuffer::Usage::Static); ? Is 100_000 still manageable ?

13
General discussions / When will shaders supported for android ?
« on: October 27, 2023, 02:25:46 pm »
Sorry I know there are several other topics about that but I can't find precise answer.
Just want to know if you are planning to rewrite stuff to handle shaders for android, I understood it's a lot a work and backward compatibility breaking so maybe for SFML 3. ?
Can I fork SFML and do it for my personal use ? Does it seems relatively doable (I mean, will it be faster to wait for you to do it)?
There is already this project https://github.com/TheMaverickProgrammer/SFML_ANDROID_ES_2 which is a fork of 2.5.1 and use gles2. If I fork from 2.6., will the work be different ?

14
General / Re: Android build error on launch
« on: August 16, 2023, 01:11:38 pm »
One of my custom file was using sf::Shader, unavailable on android with SFML.
Anyway now it's working, thank you

15
General / Android build error on launch
« on: August 15, 2023, 01:29:11 pm »
Hey,
I am trying to follow the guide with SFML 2.6 on android https://github.com/SFML/SFML/wiki/Tutorial:-Building-SFML-for-Android-on-Windows-with-Android-Studio
Build passed but on execution I have a fatal error :
Code: [Select]
2023-08-15 12:55:24.780 20653-20653 libEGL                  com.you.example.debug                E  validate_display:89 error 3001 (EGL_NOT_INITIALIZED)
2023-08-15 12:55:24.781 20653-20653 libc                    com.you.example.debug                A  C:\FactoryCapi\external_deps\SFML\src\SFML\System\Android\Activity.cpp:75: sf::priv::ActivityStates &sf::priv::getActivity(): assertion "states != NULL" failed
2023-08-15 12:55:24.781 20653-20653 libc                    com.you.example.debug                A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 20653 (u.example.debug), pid 20653 (u.example.debug)
I am using several libraries with SFML but I already made a simple project to check them and it was ok (launched as expected).
By simple project I mean a single main.cpp that calls some methods of each lib, so a very simple cmake.

But now I'm using my full source of my game with intermediate lib building and I have this error.
Just want to know if some of you already dealt with this, or have any idea about where the problem could come from.
The error occurred before the main is executed.

To give a little bit more information, here is my cmake lib dependency flow:
The example lib finally built relies on a custom lib FactoryCapi_flow
Code: [Select]
target_link_libraries(example PUBLIC
    FactoryCapi_flow
    log
    android
    sfml-graphics
    sfml-audio
    sfml-activity
    sfml-network
    -Wl,--whole-archive sfml-main -Wl,--no-whole-archive
    TGUI::TGUI
    TGUI::Activity
    EnTT::EnTT
    openal
    EGL
    GLESv1_CM
)
FactoryCapi_flow relies on FactoryCapi_core
Code: [Select]
target_link_libraries(
  FactoryCapi_flow PUBLIC
  FactoryCapi_core
)
FactoryCapi_core is built with those lib
Code: [Select]
target_link_libraries(
  FactoryCapi_core PUBLIC
  sfml-graphics
  sfml-system
  absl::flags
  absl::flags_parse
#  gRPC::grpc++_reflection
  gRPC::grpc++
  protobuf::libprotobuf
  quill::quill
)
In AndroidManifest.xml, I have
Code: [Select]
<meta-data android:name="android.app.lib_name" android:value="sfml-activity-d" />
<meta-data android:name="sfml.app.lib_name" android:value="tgui-activity-d" />
<meta-data android:name="tgui.app.lib_name" android:value="example" />
Thank you

Pages: [1] 2