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.


Topics - Nafffen

Pages: [1]
1
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

2
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

3
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

4
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

5
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

6
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 ?

7
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 ?

8
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

9
Graphics / Blur WITHOUT shader
« on: May 14, 2023, 04:11:54 pm »
Hello,
What is the best and efficient way to apply gaussian blur without shaders ? (because I want to play on android later)
Is drawing on RenderTexture and CPU compute blur the best way ? It seems too expensive to me
Thank you

10
Window / MouseWheelEvent with Trackpad, delta = 0 ?
« on: August 20, 2022, 11:59:01 pm »
Hello everyone,

I'm using SFML on Windows 10 with my laptop and I use a trackpad to move my mouse.

When it comes to MouseWheelEvent (sliding two fingers on the trackpad), the delta member is most of the time 0 which is quite disturbing for me.
Btw if I slide quickly, the delta is about +-5 and there is an inertie towards 0 (I assume it's device/system dependent) and I'm ok with that.

Edit: I noticed when you zoom with trackpad (two fingers get closer) it triggers MouseWheelEvent with a decent delta as expected. The issue is really focused on sliding two fingers (up/down) on the trackpad

Why the delta stays at 0 if the user inputs natural movement ? How can I handle it ?

Thank you

11
Graphics / Alternative of shaders on Android
« on: July 24, 2022, 10:36:59 am »
Hello everyone,

I want to bring my sfml app on Android and I'm using a little shader to blend textures from multiple mask images (black and white, ex img: maskStone512x.png) into a VertexArray on my tilemap object (can see result with img: result.PNG).
I don't want to have a texture per tile but I want a smooth background. That's why I did it this way.

If I'm right, on Android, I can't use my personal shader because of gl es 2.0 which is not supported by sfml currently.  :'(

I need to find an alternative to this utilisation.

Actually, the tilemap texture is not changing afterwards so I thought a simple sprite/texture could be ok after the generation and transmission of the texture by the server. If I do this way, is there a maximum size of sprite/texture I should not exceed to keep a good performance on android ? Should I split the tilemap in different zone to control their draw matching the size and pos of the view ? If so what size each part ?

If you have another idea to workaround :D

Thank you very much for your help

Pages: [1]
anything