justingardner / mgl

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

mglOpen and full screen displays #40

Closed justingardner closed 2 years ago

justingardner commented 2 years ago

mglOpen should be able to open up a full screen display w/out subsequently calling mglMoveDisplay and mglMetalFullscreen - this might just be a matter of fixing the .m file to work appropriately. However, there is one issue, which is that when mglMetalFullscreen is called, currently, it blacks out both screens on a two-screen system (even though it displays only on one). This behavior is a bit problematic, because typically we want to open the subject display full screen but leave the experimenter screen alone, so that the experimenter can watch the matlab buffer or other things to monitor the experiment.

Note that the previous version supported the following:

mglOpen - no arguments - would open up the 2nd screen on a two screen display mglOpen(1) open up the primary screen fullscreen mglOpen(2) open up the 2nd screen on a two screen display mglOpen(0) open up in a window.

benjamin-heasly commented 2 years ago

OK cool, thanks for laying out the previous behavior. That makes sense and I'll look to clean that up next.

I'm surprised about the fullscreen blacking out both displays! I thought fullscreen was working as expected, earlier. I'll see if I can reproduce here. If so I'll try to fix, or at least investigate what the fix would be.

benjamin-heasly commented 2 years ago

Hey @justingardner I think I fixed this up -- at least some of it. (https://github.com/justingardner/mgl/commit/48369a3fcb9c50aef6a78fcbc295339fcf75ec31).

I tried to make mglMetalOpen behave more like mglPrivateOpen, and to follow your description above. I also found an off-by-one error that I had, converting 1-based displayNumber in Matlab to 0-based screenIndex in mglMetal. A classic blunder!

I ran some test here. First I used just a single iMac display, then I used the iMac display plus a second "display" that was actually an Android tabled connected via an app called Duet.

I think it's looking good (?). Here's what I saw.

With a single iMac display:

With a second display (Android tablet via Duet):

I'm curious if you can reproduce this on your machine(s) now, and if it matches what you expect.

I wasn't able to see the fullscreen issue you mentioned. In addition to these cases, I tried opening in windowed mode, dragging the window to different displays and places, and toggling mglMetalFullscreen manually. I even tried making the window span both displays to see if that "fooled" it. Perhaps my off-by-one was contributing to what you saw. Mind trying again?

justingardner commented 2 years ago

Works beautifully on my laptop. Let me check a few other machines before closing this out though!

justingardner commented 2 years ago

I made a minor change to the behavior - if you call mgOpen without arguments on a single-display setup then it opens up as a window (rather than full screen). I think this is all now working as expected so will close out this issue.