Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EmulGL] Improve rendering quality on HiDPI Windows10 #140

Closed
jzy3d opened this issue Jan 23, 2021 · 7 comments
Closed

[EmulGL] Improve rendering quality on HiDPI Windows10 #140

jzy3d opened this issue Jan 23, 2021 · 7 comments
Milestone

Comments

@jzy3d
Copy link
Owner

jzy3d commented Jan 23, 2021

Below chart shows an aliasing improvement required on a chart rendered in Windows10 with HiDPI configuration.

image

Using CPU based rendering with this aliasing glitch remains a good workaround for the badly scaled native charts with GPU based rendering (which issue can be found here #101)

To reproduce thi aliasing problem

  • Run SurfaceDemoEmulGL or ScatterDemoEmulGL from tutorials
  • Use Windows10 with HiDPI configuration
@jzy3d jzy3d added this to the 2.0 milestone Jan 23, 2021
@jzy3d jzy3d changed the title Improve rendering quality of EmulGL charts on HiDPI Windows10 [EmulGL] Improve rendering quality on HiDPI Windows10 Jan 23, 2021
@jzy3d
Copy link
Owner Author

jzy3d commented Jan 27, 2021

Interesting comparison of offscreen painting vs onscreen painting quality

@vsonnier
Copy link

Maybe it is related with this JFreeChart issue : jfree/jfreechart#170 and a possible fix ?

@jzy3d
Copy link
Owner Author

jzy3d commented Feb 2, 2021

Applying the trick suggested by @vsonnier allows improving the pixel ratio (everything looks thiner), however, it does not deal with the aliasing effect. See work in progress in "hipdpi" branch of jGL. Pull request started to ease review of the changes.

Capture d’écran 2021-02-02 223605

@jzy3d
Copy link
Owner Author

jzy3d commented Feb 2, 2021

Disabling @vsonnier suggestions, then applying the idea of reseting the internal JVM Graphics2D scaling to 1 lead to a too small image but with no aliasing issue.

image

@jzy3d
Copy link
Owner Author

jzy3d commented Feb 2, 2021

Replacing

Image i = glImage.getScaledInstance(desiredWidth, desiredHeight, Image.SCALE_SMOOTH);
g.drawImage(i, StartX, StartY, o);

by

Image i = glImage;
g.drawImage(glImage, StartX, StartY, desiredWidth, desiredHeight, o);

provides the expected result.

image

@jzy3d
Copy link
Owner Author

jzy3d commented Feb 2, 2021

Works on MacOS as well, but noticed a rendering performance slightly larger (pixel ratio is 2x on MacOs with Retina, 1.5x on my windows running on Apple hardware with Bootcamp).

  • Scatter chart rendering time does not have a perceptible change
  • Surface chart rendering time on MacOS goes from ~35ms to ~90ms per frame

@jzy3d
Copy link
Owner Author

jzy3d commented Mar 23, 2021

Can be edited with chart's Quality setting.

@jzy3d jzy3d closed this as completed Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants