justingardner / mgl

A suite of mex/m files for displaying psychophysics stimuli
http://justingardner.net/mgl
Other
18 stars 22 forks source link

Pixels vs coordinates #61

Closed justingardner closed 2 years ago

justingardner commented 2 years ago

In mglFillOval, you are using pixel dimensions for the size rather than what the screen has been set to (usual visual angle coordinates). This shows up when we run testExperiment (which should have a patch of dots in the middle of the screen, but only shows a tiny little window) and in mglMonitorDims it should draw a bulls eye with red and grey annuli, but they are being drawn too small, for the same reason).

Please fix this, and check all the other calls for similar issues. In general, all calls should use the current coordinate frame (which is usually visual angle coordinates). One exception has been in line widths - but, I actually would prefer to update this to allow also passing in the current coordinate frame - maybe if the argument is a negative number, then it could be interpreted (in matlab) to be in current coordinates, and otherwise in pixels.

benjamin-heasly commented 2 years ago

As of a37781527151f91bc9e8143a4925e7d6035fb753 I updated all the functions that use metal dots and metal arcs, to expect sizes in device units. I updated the corresponding rendering tests as well, to get approximately the same sizes we had before.

Also, in 7b5e4a5fb6ba904c96f50a36ed13c97429b88815 I added a new function mglMetalLines which accepts a lineWidth in device units and draws wide lines as quads. This is intended to replace mglLines2, and I updated the deprecation warning in mglLines2 to point to mglMetalLines.