最近在看Cesium的源码,发现可以从创建好的program中提取uniform和Attributes, 主要代码在ShaderProgram.js中, 特意记录一下
提取uniform, 主要用到两个函数
const numberOfUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
const activeUniform = gl.getActiveUniform(program, i);
提取Attributes, 主要用到以下函数
const numberOfVertexAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
const attr = gl.getActiveAttrib(program, i);
const location = gl.getAttribLocation(program, attr.name);
标签:const,WebGL,uniform,program,ACTIVE,Attributes,gl
From: https://www.cnblogs.com/lqzv/p/17074371.html