MCPcopy Index your code
hub / github.com/microsoft/SandDance / OESVertexArrayObject

Function OESVertexArrayObject

docs/app/js/sanddance-app.js:59185–59269  ·  view source on GitHub ↗
(gl)

Source from the content-addressed store, hash-verified

59183 ].join(":");
59184};
59185var OESVertexArrayObject = function OESVertexArrayObject(gl) {
59186 var self = this;
59187 this.gl = gl;
59188 wrapGLError(gl);
59189 var original = this.original = {
59190 getParameter: gl.getParameter,
59191 enableVertexAttribArray: gl.enableVertexAttribArray,
59192 disableVertexAttribArray: gl.disableVertexAttribArray,
59193 bindBuffer: gl.bindBuffer,
59194 getVertexAttrib: gl.getVertexAttrib,
59195 vertexAttribPointer: gl.vertexAttribPointer
59196 };
59197 gl.getParameter = function getParameter(pname) {
59198 if (pname === self.VERTEX_ARRAY_BINDING_OES) {
59199 if (self.currentVertexArrayObject === self.defaultVertexArrayObject) return null;
59200 return self.currentVertexArrayObject;
59201 }
59202 return original.getParameter.apply(this, arguments);
59203 };
59204 gl.enableVertexAttribArray = function enableVertexAttribArray(index) {
59205 var vao = self.currentVertexArrayObject;
59206 vao.maxAttrib = Math.max(vao.maxAttrib, index);
59207 var attrib = vao.attribs[index];
59208 attrib.enabled = true;
59209 return original.enableVertexAttribArray.apply(this, arguments);
59210 };
59211 gl.disableVertexAttribArray = function disableVertexAttribArray(index) {
59212 var vao = self.currentVertexArrayObject;
59213 vao.maxAttrib = Math.max(vao.maxAttrib, index);
59214 var attrib = vao.attribs[index];
59215 attrib.enabled = false;
59216 return original.disableVertexAttribArray.apply(this, arguments);
59217 };
59218 gl.bindBuffer = function bindBuffer(target, buffer) {
59219 switch(target){
59220 case 34962:
59221 self.currentArrayBuffer = buffer;
59222 break;
59223 case 34963:
59224 self.currentVertexArrayObject.elementArrayBuffer = buffer;
59225 break;
59226 default:
59227 }
59228 return original.bindBuffer.apply(this, arguments);
59229 };
59230 gl.getVertexAttrib = function getVertexAttrib(index, pname) {
59231 var vao = self.currentVertexArrayObject;
59232 var attrib = vao.attribs[index];
59233 switch(pname){
59234 case 34975:
59235 return attrib.buffer;
59236 case 34338:
59237 return attrib.enabled;
59238 case 34339:
59239 return attrib.size;
59240 case 34340:
59241 return attrib.stride;
59242 case 34341:

Callers

nothing calls this directly

Calls 3

wrapGLErrorFunction · 0.70
logFunction · 0.70
maxMethod · 0.45

Tested by

no test coverage detected