TomHarte / CLK

A latency-hating emulator of: the Acorn Electron and Archimedes, Amstrad CPC, Apple II/II+/IIe and early Macintosh, Atari 2600 and ST, ColecoVision, Enterprise 64/128, Commodore Vic-20 and Amiga, MSX 1/2, Oric 1/Atmos, early PC compatibles, Sega Master System, Sinclair ZX80/81 and ZX Spectrum.
MIT License
918 stars 50 forks source link

Video output is slanted / skewed #1173

Open ryandesign opened 9 months ago

ryandesign commented 9 months ago

On my machine (a 2012 15" MacBook Pro with Retina Display running macOS Monterey 12.6.8) Clock Signal (currently version 2023-09-10 but it has been the same in all versions I tried) has slanted or skewed output. Lines which should be horizontal aren't; they are slightly diagonal. It happens in both Apple II and Macintosh emulation; I haven't tried others.

appleii macintosh

ryandesign commented 9 months ago

I also saw this problem on a 2016 15" MacBook Pro with Touch Bar running macOS Sonoma 14.0. (The screenshots in #1181 were taken on that machine.) However, it must not affect all machines, since the screenshots in the README do not exhibit this problem.

I tried to reproduce the problem on a late-2011 13" MacBook Pro but it cannot run Clock Signal because it does not support Metal.

ryandesign commented 9 months ago

The SDL/OpenGL version doesn't have this problem running on the same Mac.

TomHarte commented 9 months ago

Yeah, this is a design issue; the CRT emulation because it is really, really emulating a flying dot, actually generates a slightly lower coordinate on the right than on the left.

The OpenGL outputter internally applies a reverse skew that approximately levels them out (as in: hopefully to within a whole subsampled pixel), with the 'approximately' bit being because e.g. an Atari 2600 cartridge that generates a full display of 259 lines is going to produce scans that are slightly more slanted than one which generates 263.

Will need to rethink where proper responsibility should lie for this; I guess the scan target should be able to indicate that it needs truly-horizontal scans and the CRT should deal with it.

ryandesign commented 7 months ago

Yeah, this is a design issue; the CRT emulation because it is really, really emulating a flying dot, actually generates a slightly lower coordinate on the right than on the left.

Are you saying real CRTs have slanted lines? I've never noticed that, though the way that Clock Signal has to draw its slanted lines on an existing operating system's straight lines of pixels certainly would make it much more noticeable.

The OpenGL outputter internally applies a reverse skew that approximately levels them out (as in: hopefully to within a whole subsampled pixel), with the 'approximately' bit being because e.g. an Atari 2600 cartridge that generates a full display of 259 lines is going to produce scans that are slightly more slanted than one which generates 263.

I admit zero familiarity with the Atari 2600, real or emulated. I do see now that different cartridges used different numbers of scanlines and that TVs were apparently fine with that. But why does different numbers of scanlines require that they be slanted?

Will need to rethink where proper responsibility should lie for this; I guess the scan target should be able to indicate that it needs truly-horizontal scans and the CRT should deal with it.

Under what circumstances would you actually want non-horizontal scans?