Skip to content

Add support for ImGui v1.92.0#341

Open
jacogasp wants to merge 1 commit into
SFML:masterfrom
jacogasp:master
Open

Add support for ImGui v1.92.0#341
jacogasp wants to merge 1 commit into
SFML:masterfrom
jacogasp:master

Conversation

@jacogasp

@jacogasp jacogasp commented Apr 5, 2026

Copy link
Copy Markdown

With version v1.92.0, ImGui introduced the RenderHasTexture backend flag to enable backend to render fonts as raw textures. The current ImGui-SFML backend implementation does not support this feature and minimal examples don't run because of failing assertions.

This commit provide support for the new RenderHasTexture backend flag while supporting previous version using the IMGUI_VERSION_NUM macro.

Inspired by #336 and #330

With version v1.92.0, ImGui introduced the RenderHasTexture backend flag
to enable backend to render fonts as raw textures. The current
ImGui-SFML backend implementation does not support this feature and
minimal examples don't run because of failing assertions.

This commit provide support for the new RenderHasTexture backend flag
while supporting previous version using the IMGUI_VERSION_NUM macro
@lapinozz

Copy link
Copy Markdown
Contributor

I don't think I like the idea of supporting two API for imgui-sfml itself at the same time.
I'd rather we find a way to keep the same API or just deprecate the old version if we have to

@lapinozz

lapinozz commented May 3, 2026

Copy link
Copy Markdown
Contributor

Maybe there's a way to emulate the new API for imgui < 1.92
Since the new version always loads the default font we could get rid of that parameter and always load the font in the old version too
Maybe there's a way to detect stale font texture so the user doesn't have to manually call the UpdateFontTexture function?

@lapinozz

lapinozz commented May 3, 2026

Copy link
Copy Markdown
Contributor

Here's what I came up with. It works with ImGui < 1.92 but it has the same API and behaviour as ImGui >= 1.92
master...lapinozz:imgui-sfml:imgui-1.92

@jacogasp

jacogasp commented May 4, 2026

Copy link
Copy Markdown
Author

Hello @lapinozz,

thank you for having a look to the PR. Yea, also to me is not very elegant the usage of the macro to check ImGui version, it makes it a little cumbersome in the sake of backward compatibility. Actually I don't have an opinion on dropping entirely support for ImGui < 1.92.
Anyway, your changes to support all versions look good to me.

@milipili

Copy link
Copy Markdown

Just to inform that at least on MacOS it is currently not working great.
When using latest sfml-imgui on MacOS via vcpkg, fonts are no longer working and it crashes when quitting.
The UpdateFontTexture() requires changes of course (actually simply removed)

However those version in vcpkg work flawlessly

  • imgui:arm64-osx@1.91.9
  • imgui-sfml:arm64-osx@3.0#1

@lapinozz

Copy link
Copy Markdown
Contributor

I think the version on vcpkg has some code changed applied, hopefully once everything is figured out those should be removed

The fonts are not working even with ImGui 1.91?

@jacogasp

Copy link
Copy Markdown
Author

Just to inform that at least on MacOS it is currently not working great.

When using latest sfml-imgui on MacOS via vcpkg, fonts are no longer working and it crashes when quitting.

The UpdateFontTexture() requires changes of course (actually simply removed)

However those version in vcpkg work flawlessly

  • imgui:arm64-osx@1.91.9

  • imgui-sfml:arm64-osx@3.0#1

Yes I confirm that the vcpkg port does not work because of a patch that insert a bug in UpdateFontTexture. For making this work, I added a custom overlay that does not contain the patch and points to my fork. I added some details here.

I tested on macOS arm.

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.

3 participants