Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olafurjohannsson/d382e585613b4b09a1dadad53ee95153 to your computer and use it in GitHub Desktop.
Save olafurjohannsson/d382e585613b4b09a1dadad53ee95153 to your computer and use it in GitHub Desktop.
Scrreen coordinates to normalized coordinates, WebGL specific
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