Skip to content

Improve WebGL rendering quality with high-DPI and anisotropic filtering#154

Merged
owulveryck merged 5 commits intomainfrom
feature/webgl-rendering-quality
Feb 10, 2026
Merged

Improve WebGL rendering quality with high-DPI and anisotropic filtering#154
owulveryck merged 5 commits intomainfrom
feature/webgl-rendering-quality

Conversation

@owulveryck
Copy link
Owner

Summary

  • Add high-DPI display support by scaling canvas backing store with devicePixelRatio
  • Enable anisotropic texture filtering for improved quality during downscaling
  • Both features are GPU-accelerated with graceful degradation on older hardware

Changes

  • High-DPI Support: Canvas now renders at native pixel density (2x-4x on retina/4K displays) for crisp, sharp output
  • Anisotropic Filtering: Detects and enables EXT_texture_filter_anisotropic WebGL extension for smoother texture sampling at oblique angles
  • Maintains backward compatibility with automatic fallbacks

Test plan

  • Test on high-DPI display (retina/4K) - verify canvas dimensions are scaled by DPR
  • Test on standard display - verify no regression (DPR = 1)
  • Check browser console for anisotropic filtering detection messages
  • Verify laser pointer tracking still works correctly with DPR scaling
  • Test rotation (portrait mode) functionality
  • Verify both full frame and delta updates render properly
  • Cross-browser testing (Chrome, Firefox, Safari)

🤖 Generated with Claude Code

owulveryck and others added 4 commits February 9, 2026 16:37
Remove axis inversions in portrait mode to correctly match pen movement
with laser pointer position. In portrait mode (rotate button ON), both
X and Y coordinates now map directly without inversion.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Define BytesPerPixelBGRA and BytesPerPixelGray16 constants in config.go
- Update delta encoder to use explicit BGRA format with documentation
- Replace magic numbers with named constants in detect.go
- Add detailed documentation to getFramePointer functions explaining
  the different approaches for RM2 (classic /dev/fb0) vs RMPP (GPU/DRM)
- Improve error handling by returning errors instead of log.Fatal

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add documentation noting that the current coordinate transformation
logic has been tested and verified on RM2 but not yet on RMPP.
This maintains the working RM2 functionality while being transparent
about device-specific testing coverage.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add support for high-DPI displays by scaling canvas backing store with devicePixelRatio, ensuring crisp rendering on retina and 4K displays. Enable anisotropic texture filtering when available for improved quality during downscaling and oblique viewing angles. Both improvements are GPU-accelerated with graceful degradation on older hardware.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@owulveryck owulveryck merged commit 1170842 into main Feb 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant