2 <html style=
"margin: 0; padding: 0;">
5 <title>Simple WebGL context
</title>
6 <script src=
"webgl-test-utils.js"> </script>
8 <body style=
"margin: 0; padding: 0; overflow: hidden;">
10 width=
"1680" height=
"1050"
11 style=
"width: 256px; height: 256px;"> <!-- scaled to fit page better -->
12 <script id=
"vshader" type=
"x-shader/x-vertex">
13 attribute vec4 vPosition;
16 gl_Position = vPosition;
20 <script id=
"fshader" type=
"x-shader/x-fragment">
23 gl_FragColor = vec4(
1.0,
0.0,
0.0,
1.0);
28 var wtu
= WebGLTestUtils
;
30 var gl
= wtu
.create3DContext("c", {"antialiased": false});
31 program
= wtu
.setupProgram(gl
, ["vshader", "fshader"], ["vPosition"]);
33 var vertexObject
= gl
.createBuffer();
34 gl
.bindBuffer(gl
.ARRAY_BUFFER
, vertexObject
);
35 gl
.bufferData(gl
.ARRAY_BUFFER
, new Float32Array([ 0,0.75,0, -0.75,-0.75,0, 0.75,-0.75,0 ]), gl
.STATIC_DRAW
);
36 gl
.enableVertexAttribArray(0);
37 gl
.vertexAttribPointer(0, 3, gl
.FLOAT
, false, 0, 0);
39 gl
.clearColor(0.0, 0.0, 0.0, 1.0);
40 gl
.clear(gl
.COLOR_BUFFER_BIT
| gl
.DEPTH_BUFFER_BIT
);
41 gl
.drawArrays(gl
.TRIANGLES
, 0, 3);
44 window
.glContext
= gl
;
45 parent
.postMessage("Ready", "*");