4 <meta charset='utf-
8'
/>
5 <script src='/tests/SimpleTest/SimpleTest.js'
></script>
6 <link rel='stylesheet' href='/tests/SimpleTest/test.css'
>
7 <script src='webgl-util.js'
></script>
10 <script id='vs' type='x-shader/x-vertex'
>
12 attribute vec2 aVertCoord;
15 gl_Position = vec4(aVertCoord,
0.0,
1.0);
19 <script id='fs' type='x-shader/x-fragment'
>
21 precision mediump float;
22 uniform sampler2D uTexUnit;
25 vec4 tex = texture2D(uTexUnit, vec2(
0));
26 gl_FragColor = vec4(tex.r,
1.0,
0.0,
1.0);
36 var c
= document
.createElement('canvas');
37 gl
= c
.getContext('webgl');
39 todo(false, 'Get GL working here first.');
43 var ext
= gl
.getExtension('WEBGL_depth_texture');
45 todo(false, 'WEBGL_depth_texture not supported, which is fine.');
49 var prog
= WebGLUtil
.createProgramByIds(gl
, 'vs', 'fs');
51 ok(false, 'Program linking should succeed.');
55 var tex
= gl
.createTexture();
56 gl
.bindTexture(gl
.TEXTURE_2D
, tex
);
57 gl
.texImage2D(gl
.TEXTURE_2D
, 0, gl
.DEPTH_COMPONENT
, 1, 1, 0, gl
.DEPTH_COMPONENT
,
58 gl
.UNSIGNED_INT
, null);
60 var uTexUnit
= gl
.getUniformLocation(prog
, 'uTexUnit');
62 gl
.uniform1i(uTexUnit
, 0);
64 gl
.drawArrays(gl
.POINTS
, 0, 1);
66 ok(!gl
.getError(), 'Should have no errors.');
69 ok(true, 'Test complete.');