问题
I'm modifying a matlab code. It displays graphics using the Psychtoolbox, which can basically create an on-screen window. The code I want to adapt uses both higher-level Psychtoolbox commands and lower-level OpenGL calls, as provided by the Matlab OpenGL toolbox. I'm familiar with Psychtoolbox, not at all familiar with OpenGL.
Coordinates in Psychtoolbox are in pixels and start on (0,0) from the top-left corner of the screen and move rightwards (x) and downwards (y).
I simply need the conversion between the Matlab implementation of OpenGL coordinates and Psychtoolbox's pixel-based ones. There are a few questions and answers and many resources online about this, but I am still confused.
For example, as far as I understand OpenGL uses normalized coordinates that range between [-1, 1]. However, in the code I am adapting something is nicely displayed despite y = -1.5.
So my questions are:
- How do I convert between Matlab's OpenGL and Matlab's Psychtoobox coordinates?
- Can OpenGL coordinates in Matlab go beyond the [-1, 1] range?
来源:https://stackoverflow.com/questions/43005282/opengl-2d-coordinates-to-psychtoolbox-pixel-coordinates