diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-19 14:32:58 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-19 14:32:58 -0500 |
commit | f70007d58b8c135b7ea79a273b6772a37a541e11 (patch) | |
tree | 6379b9c7c9224d8f7f0c1ddc560f653791dd9750 /public/gl/shader | |
parent | cube working (diff) | |
download | webgl-f70007d58b8c135b7ea79a273b6772a37a541e11.tar.gz webgl-f70007d58b8c135b7ea79a273b6772a37a541e11.tar.bz2 webgl-f70007d58b8c135b7ea79a273b6772a37a541e11.zip |
changes
Diffstat (limited to 'public/gl/shader')
-rw-r--r-- | public/gl/shader/SimpleShader.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/public/gl/shader/SimpleShader.js b/public/gl/shader/SimpleShader.js new file mode 100644 index 0000000..715aa60 --- /dev/null +++ b/public/gl/shader/SimpleShader.js @@ -0,0 +1,34 @@ +import { Shader } from '../core/Shader.js' + +export const SimpleShader = () => { + + const VertexCode = ` + precision mediump float; + + attribute vec3 position; + attribute vec3 color; + + uniform mat4 proj; + uniform mat4 view; + uniform mat4 tran; + + varying vec3 color_pass; + + void main() { + color_pass = color; + gl_Position = proj * view * tran * vec4(position, 1.0); + } + ` + + const FragmentCode = ` + precision mediump float; + + varying vec3 color_pass; + + void main() { + gl_FragColor = vec4(color_pass, 1.0); + } + ` + return new Shader(VertexCode, FragmentCode) + +}
\ No newline at end of file |