Lines Matching refs:gl
2 import * as GL from 'expo-gl';
60 _onContextCreate = (gl: GL.ExpoWebGLRenderingContext) => {
62 const vert = gl.createShader(gl.VERTEX_SHADER)!;
63 gl.shaderSource(vert, vertSrc);
64 gl.compileShader(vert);
65 const frag = gl.createShader(gl.FRAGMENT_SHADER)!;
66 gl.shaderSource(frag, fragSrc);
67 gl.compileShader(frag);
70 const program = gl.createProgram()!;
71 gl.attachShader(program, vert);
72 gl.attachShader(program, frag);
73 gl.linkProgram(program);
76 const positionAttrib = gl.getAttribLocation(program, 'position');
79 const buffer = gl.createBuffer();
90 gl.clearColor(0, 0, 1, 1);
91 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
94 gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
95 gl.useProgram(program);
96 gl.enableVertexAttribArray(positionAttrib);
97 gl.vertexAttribPointer(positionAttrib, 2, gl.FLOAT, false, 0, 0);
108 gl.bufferData(gl.ARRAY_BUFFER, verts, gl.STATIC_DRAW);
109 gl.drawArrays(gl.TRIANGLES, 0, verts.length / 2);
112 gl.flush();
113 gl.endFrameEXP();