Skip to content

feat: support for 1.92.0#330

Open
majvax wants to merge 2 commits intoSFML:masterfrom
majvax:1.92.0
Open

feat: support for 1.92.0#330
majvax wants to merge 2 commits intoSFML:masterfrom
majvax:1.92.0

Conversation

@majvax
Copy link
Copy Markdown

@majvax majvax commented Sep 11, 2025

This is primarily a proof of concept rather than a production-ready implementation. I am more than happy to collaborate with the maintainers to refine this update according to your preferences and project standards.

Please note: This PR should not be merged in its current state. It lacks proper testing, and the code was written during my class, so there may be performance or memory issues that I have overlooked.

My work is based on the official documentation and the SDL3 renderer backend.

I welcome any suggestions or guidance on how to improve this contribution.

Reference:

@majvax
Copy link
Copy Markdown
Author

majvax commented Sep 11, 2025

The second commit is based of #319. As noted in the v1.91.9 changelog, parameters tint_col and border_col have been remove from ImGui::Image. The signature is deprecated and remplaced by ImGui::ImageWithBg.

After some testing, I found that the minimum supported version for these changes is v1.92.0. The new interface for textures introduced in this version breaks compatibility with earlier releases, so support for versions prior to 1.92.0 is not feasible. The good news is that these updates are compatible up to v1.92.2b, and ImGui can now be compiled with IMGUI_DISABLE_OBSOLETE_FUNCTIONS enabled.

@majvax
Copy link
Copy Markdown
Author

majvax commented Sep 11, 2025

I believe upgrading to 1.92.0 is necessary, as ImGui will require this update moving forward. As quoted from the doc:

"In order to move forward and take advantage of all new features, support for ImGuiBackendFlags_RendererHasTextures will likely be REQUIRED for all backends before June 2026"

@majvax
Copy link
Copy Markdown
Author

majvax commented Sep 13, 2025

@ChrisThrasher What do you think of this?

@ChrisThrasher
Copy link
Copy Markdown
Member

So you’re saying that supporting ImGui 1.92 means all prior versions become unusable? We have to raise the minimum from 1.91.1 to 1.92?

@majvax
Copy link
Copy Markdown
Author

majvax commented Sep 16, 2025

That’s basically what I’m saying, yes. Certainly, we could use macros to provide version-specific code, but I don’t think that fits the modern C++ approach of SFML.

@ChrisThrasher
Copy link
Copy Markdown
Member

Does ImGui provide macros for detecting the current version?

@majvax
Copy link
Copy Markdown
Author

majvax commented Sep 16, 2025

I didn't look at it myself but trusting this comment I would say yes.

@mikademus
Copy link
Copy Markdown

mikademus commented Oct 18, 2025

Would it be helpful to stage the updates rather than try to get all fixes in at once? It seems that the most urgent change is the texture changes. ImGui-SFLM overloads ImGui::Image and ImGui::ImageButton for sf::Texture, sf::Sprite and sf::RenderTexture, and I think basically need updates to the texture ID semantic? This seems separate from the font revisions, and a manageable high-reward step.

@Caerind
Copy link
Copy Markdown

Caerind commented Feb 6, 2026

Hello!
I'm using a different version of imgui-sfml, but thank you a lot your implementation was a good starting point!
Though I found some issues that needs to be addressed :

  • In UpdateFontTexture, you are doing '=' instead of '==' in all the conditions !
  • In UpdateFontTexture, I would remove the else and use 'tex->Status == ImTextureStatus_WantDestroy', this is probably not required, but more robust
  • And in the same branch, you are doing the SetTexID to invalid before getting it. So you never actually destroy the concerned texture
  • UpdateFontTexture should be renamed UpdateTexture probably
  • We should remove the "fontTexture" and its access in the .h
  • Also, I removed the usage of the unordered_map by storing a raw pointer to a sf::Texture* I manage directly and store into the tex->BackendUserData

@Caerind
Copy link
Copy Markdown

Caerind commented Feb 6, 2026

I also had to make some other changes to support more fonts, I made the commit in a fork:
862d459

@majvax
Copy link
Copy Markdown
Author

majvax commented Feb 6, 2026

Hey, first I'm not really into ImGui programming nor SFML itself and I don't have the experience to actually come with a fix. As I said this code was wrotten during class and is poorly written. I just serve as a poc of the support for 1.92.0.
Addressing the different point made in your message

  • great catch for the conditions ! I don't really know how could I wrote that nor how my compiler/build tool didn't catch it, I believe that before AI slop is human slop haha
  • using else if instead of else is as you said way more robust.
  • nice catch I must admit I quite laugh at this snippet of code while reviewing it
  • I didn't understand what you meant by fontTexture as I wrote this code a while ago and didn't find anything related into the code except the s_currWindowCtx->fontTexture. Could you precise more what you meant here?
  • for the unordered_map, I found the tex->BackendUserData but never fix it since 1.92.0 is not something planned.

To sum up I needed 1.92.0 for a project that is now finished. For the sake of open source I will update the code when I have the time to even if 1.92.0 support isn't planned.

@majvax
Copy link
Copy Markdown
Author

majvax commented Feb 6, 2026

I also had to make some other changes to support more fonts, I made the commit in a fork: 862d459

Thank you for your contribution. If you’re interested, I can close my PR and you can open a new one based on your fork/commit.

@Caerind
Copy link
Copy Markdown

Caerind commented Feb 6, 2026

Hey !
I should have precised it in my post, but I'm using ImGui 1.92.5 & SFML 2.6 (for a stupid reason, but don't ask why ahah), so I have some custom changes on imgui-sfml.

I didn't understand what you meant by fontTexture as I wrote this code a while ago and didn't find anything related into the code except the s_currWindowCtx->fontTexture. Could you precise more what you meant here?

Yes exactly! That fontTexture is not needed anymore, so it should be removed, and with that the GetFontTexture function.

I made a PR which is here : #336
(Also I think it is currently not working because I have some Texture changes that are not on the main branch, but I'll update that very soon)

And thank you again, your PR helped me for a good start!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants