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

Work in pixels #624

Open
bigidea-kz opened this issue Jul 25, 2021 · 0 comments
Open

Work in pixels #624

bigidea-kz opened this issue Jul 25, 2021 · 0 comments

Comments

@bigidea-kz
Copy link

Hello!
How to use this code with regl?

const vert = `
  precision mediump float;
  attribute vec2 position;
  uniform vec2 resolution;

  void main() {
    vec2 zeroToOne = position.xy / resolution;
    vec2 zeroToTwo = zeroToOne * 2.0;
    vec2 clipSpace = zeroToTwo - 1.0;
    gl_Position = vec4(clipSpace, 0, 1);
  }
`

const gl = canvas.getContext("webgl")
const resolutionUniformLocation = gl.getUniformLocation(program, "resolution")

gl.uniform2f(resolutionUniformLocation, gl.canvas.width, gl.canvas.height)
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

No branches or pull requests

1 participant