Hacker News new | past | comments | ask | show | jobs | submit login

As stated, the driver contains a shader compiler. Personally, I like to see examples, so here's a snippet of code that would compile a WebGL shader:

var gl = canvas.getContext('webgl');

var vShaderSource = document.getElementById('vShader');

var vShader = gl.createShader(gl.VERTEX_SHADER);

gl.shaderSource(vShader, vShaderSource);

gl.compileShader(vShaderSource);

"vShader" is the id of a <script> tag of type "x-shader/x-vertex". Get a WebGL context, get the shader source, create a shader object, bind the source to the shader, then compile the source.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: