town-page/_posts/2021-06-02-more-shaders.mar...

33 lines
920 B
Markdown
Raw Normal View History

2021-06-02 08:15:27 +00:00
---
layout: post-plain
title: "More Shaders"
date: 2021-06-02
categories: design coding
---
<canvas id="webgl-canvas" width="1280" height="1280" style="border:1px solid white; width:100%;">
<script type="x-shader/x-vertex" id="vertex-shader">
#version 100
precision highp float;
attribute vec4 aVertexPosition;
uniform mat4 uModelViewMatrix;
uniform mat4 uProjectionMatrix;
void main(void) {
gl_Position = uProjectionMatrix * uModelViewMatrix * aVertexPosition;
}
</script>
<script type="x-shader/x-fragment" id="fragment-shader">
#version 100
precision mediump float;
uniform float uTime;
uniform vec2 uResolution;
uniform vec4 uFragColor;
void main() {
vec2 uv = gl_FragCoord.xy / uResolution.xy;
gl_FragColor = vec4(uv.x, uv.y, uTime / 10.0, 0.0);
}
</script>
</canvas>
{% asset gl-matrix-min-2.8.1.js %}
{% asset shaderCanvas4.js %}