Created
October 7, 2022 21:27
-
-
Save dghez/980f98fe6a56d34cccd07913de69fb4f to your computer and use it in GitHub Desktop.
Fullscreen quad on threejs
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
this.geometry = new BufferGeometry() | |
const vertices = new Float32Array([ | |
-1.0, -1.0, | |
3.0, -1.0, | |
-1.0, 3.0, | |
]) | |
const uvs = new Float32Array([0, 0, 2, 0, 0, 2]) | |
this.geometry.setAttribute('uv', new BufferAttribute(uvs, 2)) | |
this.geometry.setAttribute('position', new BufferAttribute(vertices, 2)) | |
this.material = new ShaderMaterial({ | |
vertexShader, | |
fragmentShader, | |
uniforms: { | |
.... | |
}, | |
}) | |
// VERTEX | |
void main() { | |
gl_Position = vec4(position.xy, 1.0, 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment