var canvas = document.getElementById("webgl");
var gl = getWebGLContext(canvas);
attribute、uniform、varying变量
pdf210页
attribute变量只能出现在顶点着色器中,只能被声明为全局变量,被用来表示逐顶点的信息。
uniform变量可以用在顶点着色器和片元着色器中,且必须是全局变量。uniform是只读的。可以是除了数组或结构体以外的任意类型。(可以理解为声明常量。)
varying变量必须是全局变量,它的任务是从顶点着色器向片元着色器传输数据。必须在两种着色器中声明同名、同类项的varying变量。
gl.getWebGLContext
见pdf19页
gl.clearColor
见pdf20页
gl.clear
见pdf21页
initShaders
见pdf30页
vec4
见pdf33页
gl.drawArrays
见pdf34页
gl.getAttribLocation
见pdf41页
gl.vertexAttrib3f
见pdf42页
gl.vertexAttrib3f同族函数
见pdf44页
gl.getUniformLocation
见pdf59页
gl.uniform4f
见pdf60页
gl.uniform4f同族函数
见pdf61页
gl.createBuffer
见pdf71页
gl.deleteBuffer
见pdf71页
gl.bindBuffer
见pdf72页
gl.bufferData
见pdf73页
类型化数组
见pdf74页
注意:与普通的Array数组不同,类型化数组不支持push()和pop()方法
gl.vertexAttribPointer
见pdf76页
gl.enableVertexArray
见pdf77页
gl.disableVertexArray
见pdf77页
gl.uniformMatrix4fv
见pdf105页
Matrix4对象所支持方法和属性
gl.createTexture
见pdf161页
gl.deleteTexture
见pdf161页
gl.pixelStorei
见pdf165页
gl.activeTexture
见pdf166页
gl.bindTexture
见pdf167页
gl.texParameteri
见pdf168页
gl.texImage2D
见pdf171页
Matrix4.setLookAt
pdf220页
gl.polygonOffset
pdf264页
gl.drawElements
pdf268页