mikke89 / RmlUi

RmlUi - The HTML/CSS User Interface library evolved
https://mikke89.github.io/RmlUiDoc/
MIT License
2.57k stars 295 forks source link

SetDensityIndependentPixelRatio does not cause a change with GLFW3 GL3 #602

Closed niansa closed 2 months ago

niansa commented 3 months ago

Hi. Currently trying to figure out if I can target devKitPro (Switch) with RmlUi. And indeed! It works:

image

However, the DPI is clearly wrong. So I'm doing this:

ctx = Rml::CreateContext("main", resolution);
ctx->SetDensityIndependentPixelRatio(2.f);

However, there is no visible difference even with values like 20. What could be wrong here?

mikke89 commented 3 months ago

Nice, cool to hear it working in that environment.

Please try using dp units instead of px units if you're not already doing that.

niansa commented 3 months ago

Yes, I'm already using dp units.

mikke89 commented 3 months ago

Are you using our backend directly? Please note that this backend handles DPI-changes automatically, so please check that you're not being overridden by the built-in behavior. Otherwise, please provide a full reproducible so we can understand exactly what is being done here.

niansa commented 3 months ago

Yes, I am using the backend directly. Should I copy it into my own source tree to remove the DPI handling code?

mikke89 commented 3 months ago

Yeah, that would be one approach. For testing you could also try setting the dp-ratio during your update loop.