Can shader code be kept in a textarea like this (angle brackets removed for proper display):
textarea id="vshader" style="display:none;" uniform mat4 worldviewproj; attribute vec4 vPosition; attribute vec4 vNormal; attribute vec2 vTexCoord1; attribute vec2 vTexCoord2; varying vec2 v_texCoord1; varying vec2 v_texCoord2; void main() { gl_Position = worldviewproj * vPosition; v_texCoord1 = vTexCoord1.st; v_texCoord2 = vTexCoord2.st; } /textarea
...
var newMaterialType = engine.getRenderer().createMaterialType( document.getElementById('vshader').value, document.getElementById('fshader').value );
A Google O3D tutorial uses this technique. I haven't had luck getting this to work with CopperLicht though. It seems to be using a default shader.
|