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

Author Topic: Rendering only oriented window wrapper?  (Read 4551 times)

0 Members and 1 Guest are viewing this topic.

barnack

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Rendering only oriented window wrapper?
« on: December 11, 2021, 09:06:44 pm »
Hi,
I've always liked how SFML makes its modules almost independent from one another. You can have SFML's event management on SFML's Window and do the rendering with a completely different library, you can use SFML's sound without even having a window, and so on.

But recently I've been exploring Windows window customization to a degree SFML doesn't allow, and on top of that I wanted to build my own event management system (closer to GLFW's than SFML's).

And here the truth hurt me: I couldn't find a single way to use only SFML's Graphics component onto an existing window without it being intrusive about the event system too.
As far as I could read from past topics, SFML creates its own context on windows, which is fine, but if the only way to do that is creating an sf::RenderWindow, that will force SFML's window management and event system as well, in particular replacing the window procedure and the data cointained in the user pointer on the Windows implementation.
That's a consequence of sf::RenderWindow inheriting from sf::Window, which exists for the purpose of adding SFML's event system to a window (if my understanding is correct)

Is there any way to achieve what I'm looking for (without rendering SFML stuff to a temporary rendertexture and copy that texture in opengl to the buffer)?

If there isn't, I'd move this topic in the feature requests section and I'd propose the addition of either
- an "sf::RenderContext" which is built by passing it a raw OpenGL context and exposes draw() and clear() on that. The construction should fail if the context is not created with settings expected by SFML (like double buffering).
- an "sf::RenderOnlyWindow" which sets up the required render context, exposes the drawing methods, but does NOT interfere with a window's event management.
Either should also expose a context resizing method to be called manually.
« Last Edit: December 11, 2021, 09:22:43 pm by barnack »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10930
    • View Profile
    • development blog
    • Email
Re: Rendering only oriented window wrapper?
« Reply #1 on: January 07, 2022, 09:10:59 pm »
As discussed on Discord SFML isn't really designed in this way, you really get more or less all or nothing and can't pick part of the window management.

I currently don't see SFML moving in such a direction, especially in its current form, where if you put in the effort to write your own window management and event handling, that it shouldn't be too big of jump, to loading and rendering your own texture and vertex arrays.

But if you want, you can still open a feature request and provide some use cases. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything