1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/test/webgl-conformance/conformance/limits/gl-min-attribs.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,85 @@ 1.4 +<!-- 1.5 +Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.6 +Use of this source code is governed by a BSD-style license that can be 1.7 +found in the LICENSE file. 1.8 + --> 1.9 +<!DOCTYPE html> 1.10 +<html> 1.11 +<head> 1.12 +<meta charset="utf-8"> 1.13 +<title>WebGL the minimum number of attributes are supported.</title> 1.14 +<link rel="stylesheet" href="../../resources/js-test-style.css"/> 1.15 +<script src="../../resources/js-test-pre.js"></script> 1.16 +<script src="../resources/webgl-test.js"> </script> 1.17 +<script src="../resources/webgl-test-utils.js"> </script> 1.18 +</head> 1.19 +<body> 1.20 +<canvas id="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas> 1.21 +<div id="description"></div> 1.22 +<div id="console"></div> 1.23 +<script id="vshader" type="x-shader/x-vertex"> 1.24 +attribute vec4 vPosition; 1.25 +attribute vec4 v0; 1.26 +attribute vec4 v1; 1.27 +attribute vec4 v2; 1.28 +attribute vec4 v3; 1.29 +attribute vec4 v4; 1.30 +attribute vec4 v5; 1.31 +attribute vec4 v6; 1.32 +varying vec4 color; 1.33 +void main() 1.34 +{ 1.35 + gl_Position = vPosition; 1.36 + color = v0 + v1 + v2 + v3 + v4 + v5 + v6; 1.37 +} 1.38 +</script> 1.39 + 1.40 +<script id="fshader" type="x-shader/x-fragment"> 1.41 +precision mediump float; 1.42 +varying vec4 color; 1.43 +void main() 1.44 +{ 1.45 + gl_FragColor = color; 1.46 +} 1.47 +</script> 1.48 +<script> 1.49 +description(document.title); 1.50 +var wtu = WebGLTestUtils; 1.51 +var gl = wtu.create3DContext("example"); 1.52 +var program = wtu.setupTexturedQuad(gl); 1.53 + 1.54 +var program = wtu.setupProgram( 1.55 + gl, 1.56 + ['vshader', 'fshader'], 1.57 + ['vPosition', 'v0', 'v1', 'v2', 'v3', 'v4', 'v5', 'v6'], 1.58 + [0, 1, 2, 3, 4, 5, 6, 7]); 1.59 + 1.60 +for (var ii = 0; ii < 7; ++ii) { 1.61 + var v = (ii + 1) / 28; 1.62 + var vertexObject = gl.createBuffer(); 1.63 + gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); 1.64 + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 1.65 + v, v/2, v/4, v/8, 1.66 + v, v/2, v/4, v/8, 1.67 + v, v/2, v/4, v/8, 1.68 + v, v/2, v/4, v/8, 1.69 + v, v/2, v/4, v/8, 1.70 + v, v/2, v/4, v/8]), gl.STATIC_DRAW); 1.71 + gl.enableVertexAttribArray(ii + 1); 1.72 + gl.vertexAttribPointer(ii + 1, 4, gl.FLOAT, false, 0, 0); 1.73 +} 1.74 + 1.75 +wtu.drawQuad(gl); 1.76 +glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); 1.77 +wtu.checkCanvasRect(gl, 0, 0, gl.canvas.width, gl.canvas.height, [255, 127, 64, 32], "Should render 255,127,64,32 (+/-1)", 1); 1.78 + 1.79 +successfullyParsed = true; 1.80 + 1.81 +</script> 1.82 +</body> 1.83 +<script>finishTest();</script> 1.84 + 1.85 +</body> 1.86 +</html> 1.87 + 1.88 +