GithubHelp home page GithubHelp logo

Comments (4)

pthom avatar pthom commented on June 1, 2024

You are experiencing a known quirk with ImGui: see this extract from the ImGui FAQ:

The reason DPI is not auto-magically solved in stock examples is that we don't yet have a satisfying solution for the "multi-dpi" problem (using the docking branch: when multiple viewport windows are over multiple monitors using different DPI scales). The current way to handle this on the application side is:
Create and maintain one font atlas per active DPI scale (e.g. by iterating platform_io.Monitors[] before NewFrame()).
Hook platform_io.OnChangedViewport() to detect when a Begin() call makes a Dear ImGui window change monitor (and therefore DPI).
In the hook: swap atlas, swap style with correctly sized one, and remap the current font from one atlas to the other (you may need to maintain a remapping table of your fonts at varying DPI scales).

HelloImGui tries hard to add many additional steps to handle DPI correctly on different platforms.
However, this is a very difficult a time consuming task, since different platforms, or different app settings handle DPI differently.

Moving a window between monitors having different DPIs is not handled at the moment, since this would require 1/ changing the font atlas whenever the windows switches to a different monitor, and 2/ adapt the window size to account for the DPI change (on windows).

However, under macOS we might be lucky, since the window physical size (in millimeter) will likely not change when moving from one Retina screen to a non retina screen.

Last week, I was confronted to this issue, which lead me to introduce some settings:

See dpi_aware.h

If you create a hello_imgui.ini file where you place

[DpiAwareParams]
dpiWindowSizeFactor=1
fontRenderingScale=0.5

(or if you set those values inside runnerParams.dpiAwareParams), you will disconnect HelloImGui automatic DPI detection.

In this case, fonts will be loaded at twice the size and scaled by 0.5 upon rendering, which will likely improve the situation. The fonts will use more texture memory (but it will be the same as when running directly on the retina screen, since in that case HelloImGui will apply fontRenderingScale=0.5 automatically).

Please keep me informed of the result

from hello_imgui.

wkjarosz avatar wkjarosz commented on June 1, 2024

Thanks. I can confirm that setting those programmatically does indeed make the app use crisp fonts on the retina screen (though the fonts therefore look notably crunchy/jagged on the non-retina screen -- a compromise I'm willing to deal with for now).

from hello_imgui.

pthom avatar pthom commented on June 1, 2024

Thanks,
I took a few minutes to build and look at the imgui branch of your hdrview project, it looks extremely nice!

from hello_imgui.

wkjarosz avatar wkjarosz commented on June 1, 2024

Thanks!

from hello_imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.