amethyst / bracket-lib

The Roguelike Toolkit (RLTK), implemented for Rust.
MIT License
1.49k stars 110 forks source link

WebGL: No resize, scaling, screenshot, or HiDPI support, and linear filtering is used #254

Open jasonjmcghee opened 2 years ago

jasonjmcghee commented 2 years ago

I've been on a deep dive in WebGL and there is a fair amount of missing functionality.

I've managed to implement the aforementioned missing features on a separate branch.

It'd be great to integrate the features into the main repo.

This is the branch: https://github.com/jasonjmcghee/bracket-lib/tree/issue_254_webgl_missing-features

(Here's an link for the comparison)

If there is support here / buy-in I'm happy to add comments / documentation to ensure everything is abundantly clear, or test coverage anywhere that makes sense. I've just been following existing patterns for this code.

So - what changed?

Note: On the branch I have a number of CSS changes on the index.html itself - no reason it couldn't be all rust.

Before

(only using my fix in #251, to fix the black screen):

Generally how it looks (locked at 640x480, with no HiDPI):

Screen Shot 2022-01-04 at 6 30 44 PM

Zoomed way in (blurry):

Screen Shot 2022-01-04 at 6 30 14 PM

After

This is taken with the new screenshot method :) (make sure to click the image - 0 blurriness) screenshot(1)

This is zoomed way in:

Screen Shot 2022-01-04 at 6 23 27 PM

Scaling / Auto-resize:

Screen Shot 2022-01-04 at 6 27 53 PM Screen Shot 2022-01-04 at 6 34 18 PM
jasonjmcghee commented 2 years ago

Here is the screenshot example (Press S to take a screenshot):

Here are the WebGL (from main repo) examples hosted statically: