mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
webgl: tests: Fix webgl triangle test
It was giving a ton of whitespace errors, and I don't know if it's due to nodeValue or ANGLE...
This commit is contained in:
parent
6fcc03c965
commit
ee8ecd9299
1 changed files with 17 additions and 12 deletions
|
@ -9,23 +9,25 @@
|
||||||
<canvas id="canvas" width="512" height="512"></canvas>
|
<canvas id="canvas" width="512" height="512"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<script id="vertexshader" type="x-shader">
|
<script id="vertexshader" type="x-shader">
|
||||||
attribute vec2 aVertexPosition;
|
precision mediump float;
|
||||||
attribute vec4 aColour;
|
|
||||||
varying vec4 aVertexColor;
|
|
||||||
|
|
||||||
void main() {
|
attribute vec2 aVertexPosition;
|
||||||
aVertexColor = aColour;
|
attribute vec4 aColour;
|
||||||
gl_Position = vec4(aVertexPosition, 0.0, 1.0);
|
varying vec4 aVertexColor;
|
||||||
}
|
|
||||||
|
void main() {
|
||||||
|
aVertexColor = aColour;
|
||||||
|
gl_Position = vec4(aVertexPosition, 0.0, 1.0);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<script id="fragmentshader" type="x-shader">
|
<script id="fragmentshader" type="x-shader">
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
varying vec4 aVertexColor;
|
varying vec4 aVertexColor;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_FragColor = aVertexColor;
|
gl_FragColor = aVertexColor;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
@ -44,6 +46,9 @@
|
||||||
var v = document.getElementById("vertexshader").firstChild.nodeValue;
|
var v = document.getElementById("vertexshader").firstChild.nodeValue;
|
||||||
var f = document.getElementById("fragmentshader").firstChild.nodeValue;
|
var f = document.getElementById("fragmentshader").firstChild.nodeValue;
|
||||||
|
|
||||||
|
console.log("vertex source: ", v);
|
||||||
|
console.log("fragment source: ", f);
|
||||||
|
|
||||||
var vs = gl.createShader(gl.VERTEX_SHADER);
|
var vs = gl.createShader(gl.VERTEX_SHADER);
|
||||||
gl.shaderSource(vs, v);
|
gl.shaderSource(vs, v);
|
||||||
gl.compileShader(vs);
|
gl.compileShader(vs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue