Skip to content

Instantly share code, notes, and snippets.

@baptistebriel
Forked from Samsy/frag
Created September 26, 2018 17:06
Show Gist options
  • Save baptistebriel/90856493261a5934ce0a38cfd9d5bff7 to your computer and use it in GitHub Desktop.
Save baptistebriel/90856493261a5934ce0a38cfd9d5bff7 to your computer and use it in GitHub Desktop.
triangle
uniform sampler2D tex;
varying vec2 vUv;
void main() {
gl_FragColor = texture2D( tex, vUv );
}
import * as three from 'three'
class Triangle extends three.BufferGeometry {
constructor(){
super()
this.setIndex( [2, 1, 0] )
this.addAttribute( 'position', new three.Float32BufferAttribute(
[
-1, -1, 0,
-1, 4, 0,
4, -1, 0
]
, 3 ));
this.needsUpdate = true
}
}
let tri = new Triangle()
export default tri;
varying vec2 vUv;
void main() {
vUv = vec2(0.5)+(position.xy)*0.5;
gl_Position = vec4( position.xy, 0.0, 1.0 );;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment