RustAudio / baseview

low-level window system interface for audio plugin UIs
Apache License 2.0
267 stars 57 forks source link

Scaling issues on MacOS Retina #105

Closed sagacity closed 2 years ago

sagacity commented 2 years ago

I'm seeing issues with the rendering of a VST UI in Reaper on a Macbook with a Retina display.

This happens both with imgui-baseview and with egui-baseview.

Here's what happens with the Gain example from https://github.com/DGriffin91/imgui_baseview_test_vst2, for instance (this is Reaper's "FX Chain" UI btw):

Scaling issue

The same thing happens with any other imgui or egui example. There is some rendering going on though: changing the clear_color of the window has effect, for instance. The only way I can fix this is by hard-coding the scale_factor of the window to 1.0 here. Supplying a WindowScalePolicy::ScaleFactor(1.0) in the WindowOpenOptions should do the same thing, but does not seem to have any effect.

If I manually double the window size in the example code here, then I do see the outlines of some UI being rendered, completely off-center and clipped:

Scaling issue 2

Stepping through the baseview code, I do see that the logical size is the size that is being configured by me and the physical size is double that (since scale_factor is calculated to be 2.0). I am assuming the issue is not related specifically to either the imgui or egui renderers since they both exhibit the same behaviour. Additionally, running the imgui-baseview examples by themselves (i.e. outside of the VST host) works fine as well. So I'm a bit stumped on what the root cause could be.

greatest-ape commented 2 years ago

It might be related to the issue this PR solves: https://github.com/glowcoil/raw-gl-context/pull/13

sagacity commented 2 years ago

If I have some time soon, I'll try to give it a quick test!

sagacity commented 2 years ago

@greatest-ape I can confirm this solves the issue, when using the latest baseview and imgui-baseview revisions together with your raw-gl-context patch. Great :)

greatest-ape commented 2 years ago

@sagacity my PR has been merged now!

sagacity commented 2 years ago

Awesome 😍