Created
November 1, 2018 21:22
-
-
Save olafurjohannsson/d382e585613b4b09a1dadad53ee95153 to your computer and use it in GitHub Desktop.
Scrreen coordinates to normalized coordinates, WebGL specific
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function screenToNdc(x, y) { | |
return [(x / window.innerWidth) * 2 - 1, (y / window.innerHeight) * 2 + 1]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment