parasyte / pixels

A tiny hardware-accelerated pixel frame buffer. 🦀
https://docs.rs/pixels
MIT License
1.82k stars 123 forks source link

Scaling display with GPU #52

Closed tallen11 closed 4 years ago

tallen11 commented 4 years ago

Hi, in the announcement posts for this package, there was an example of a chip8 emulator written with it that had a 64x32 pixels screen that was scaled up 50x. How do I do this?

parasyte commented 4 years ago

Seems like maybe you worked it out on your own. But here's an answer for anyone else who happens on this issue in the future:

pixels will scale the texture to fit in the window. It tries to scale at integer sizes only, so e.g. 1x, 2x, ... 50x, but not fractional sizes like 1.5x or 3.1415926x. The easiest way to scale a 64x32 screen to 50x is simply by making the window size (64*50)x(32*50), which is 3200x1600. The GPU will do the rest automagically.