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

Pages: [1]
1
SFML development / Providing own WindowImpl backend?
« on: October 27, 2023, 07:02:04 pm »
Hi there.
I am currently trying to adapt SFML for rendering with EGL on raspberry, and it requires OpenGL ES
which are supported by SFML, but there's a small nuance:
- its initializing it in different way, than in other example that using DRM mode for creating context..
Basically with SFML the OpenGL ES gives me this:

OpenGL ES 2.x information:
  version: "2.1 Mesa 20.3.5"
  shading language version: "1.20"
  vendor: "Broadcom"
  renderer: "V3D 4.2"

But with kmscube example, i have this:

OpenGL ES 2.x information:
  version: "OpenGL ES 3.1 Mesa 20.3.5"
  shading language version: "OpenGL ES GLSL ES 3.10"
  vendor: "Broadcom"
  renderer: "V3D 4.2"

This is of course unfortunate, that when creating context using SFML library i cannot get 3.1 feature set.

So, my question whether it is possible to "extend" SFML library by providing own custom implementation of WindowImpl,
which will create & initialize system resources in proper way.
I don't wanna hack inside the library itself, is there a clean way to do that at all?

I would like to have something like that:

class MyWindowImpl : ....
class MyContextImpl : ...

int main() {
...

sf::RenderWindow<MyWindowImpl, MyContextImpl> myWindow( ... );
,,,
myWindow.draw(...)
}

Is there a way how to do that without hacking the library source code itself?
If so, it would be nice if you can provide some guidance.

Because i found it is determining WindowImpl in the library itself, and it is nailed down to platform-specific ifdefs..

for context:
#elif defined(SFML_OPENGL_ES)

#include <SFML/Window/EglContext.hpp>
using ContextType = sf::priv::EglContext;

and similarly for window:

#if defined(SFML_USE_DRM)

#include <SFML/Window/DRM/WindowImplDRM.hpp>
using WindowImplType = sf::priv::WindowImplDRM;

It would be nice to make it extensible, i.e.
using template arguments for specific context and window implementation class, and provide the above configuration
as a convenient defaults, but in case, like mine, for those who would like to create/initialize context & window using own way,
provide own implementation..

How hard it would be to do ?


Pages: [1]
anything