CALProjectImageSet: Make portable to non-Windows, minor robustness im… #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…provement.
Hi, Psychtoolbox developer here. Cool project! A user of us just asked me to support him in using your toolkit:
See https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707 for reference.
I thought i propose some minor improvements to make it possibly portable to non-Windows, or at least Psychtoolbox bits should not prevent portability. This code is untested, but should be correct or trivially fixable in case i made a typo.
Using KbName() allows to get rid of the mystic key numbers.
Using KbName('UnifyKeyNames') makes this also work on Linux or macOS.
Moving the version checks to the top, because otherwise it would already be too late to verify.
Other possible minor performance improvement would be to use
Screen('FillRect', obj.SLM, 0);
instead ofScreen(obj.SLM, 'PutImage',obj.blank_image);
to simply clear the screen to black. In general,PutImage
is the slowest way to get an image to the screen. A combination ofMakeTexture
to convert a matlab matrix into a texture handle before the actual realtime presentation sequence, andDrawTexture
to draw it fast into the window, may be a speed advantage on low-end or slow machines.Maybe using of the timestamping and timing features of
Screen('Flip')
would also be advantageous for stable presentation timing during the lithography presentation sequence, compared to use of tic, toc etc.Best,
-mario