Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CALProjectImageSet: Make portable to non-Windows, minor robustness im… #3

Merged
merged 1 commit into from Mar 6, 2021

Conversation

kleinerm
Copy link
Contributor

@kleinerm kleinerm commented Mar 5, 2021

…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 of Screen(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 of MakeTexture to convert a matlab matrix into a texture handle before the actual realtime presentation sequence, and DrawTexture 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

…provement.

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.
@jttoombs jttoombs merged commit c569687 into computed-axial-lithography:master Mar 6, 2021
@jttoombs
Copy link
Member

jttoombs commented Mar 6, 2021

Thanks a lot for the suggestions! I have added the key name and blank image suggestions to v1.1.5 and will work on the image textures for a later release.

@kleinerm kleinerm deleted the patch-1 branch March 6, 2021 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants