MCPcopy Create free account
hub / github.com/microsoft/SandDance / OESVertexArrayObject

Function OESVertexArrayObject

docs/tests/v3/es6/js/sanddance-test-es6.js:7116–7200  ·  view source on GitHub ↗
(gl)

Source from the content-addressed store, hash-verified

7114 ].join(":");
7115};
7116var OESVertexArrayObject = function OESVertexArrayObject(gl) {
7117 var self = this;
7118 this.gl = gl;
7119 wrapGLError(gl);
7120 var original = this.original = {
7121 getParameter: gl.getParameter,
7122 enableVertexAttribArray: gl.enableVertexAttribArray,
7123 disableVertexAttribArray: gl.disableVertexAttribArray,
7124 bindBuffer: gl.bindBuffer,
7125 getVertexAttrib: gl.getVertexAttrib,
7126 vertexAttribPointer: gl.vertexAttribPointer
7127 };
7128 gl.getParameter = function getParameter(pname) {
7129 if (pname === self.VERTEX_ARRAY_BINDING_OES) {
7130 if (self.currentVertexArrayObject === self.defaultVertexArrayObject) return null;
7131 return self.currentVertexArrayObject;
7132 }
7133 return original.getParameter.apply(this, arguments);
7134 };
7135 gl.enableVertexAttribArray = function enableVertexAttribArray(index) {
7136 var vao = self.currentVertexArrayObject;
7137 vao.maxAttrib = Math.max(vao.maxAttrib, index);
7138 var attrib = vao.attribs[index];
7139 attrib.enabled = true;
7140 return original.enableVertexAttribArray.apply(this, arguments);
7141 };
7142 gl.disableVertexAttribArray = function disableVertexAttribArray(index) {
7143 var vao = self.currentVertexArrayObject;
7144 vao.maxAttrib = Math.max(vao.maxAttrib, index);
7145 var attrib = vao.attribs[index];
7146 attrib.enabled = false;
7147 return original.disableVertexAttribArray.apply(this, arguments);
7148 };
7149 gl.bindBuffer = function bindBuffer(target, buffer) {
7150 switch(target){
7151 case 34962:
7152 self.currentArrayBuffer = buffer;
7153 break;
7154 case 34963:
7155 self.currentVertexArrayObject.elementArrayBuffer = buffer;
7156 break;
7157 default:
7158 }
7159 return original.bindBuffer.apply(this, arguments);
7160 };
7161 gl.getVertexAttrib = function getVertexAttrib(index, pname) {
7162 var vao = self.currentVertexArrayObject;
7163 var attrib = vao.attribs[index];
7164 switch(pname){
7165 case 34975:
7166 return attrib.buffer;
7167 case 34338:
7168 return attrib.enabled;
7169 case 34339:
7170 return attrib.size;
7171 case 34340:
7172 return attrib.stride;
7173 case 34341:

Callers

nothing calls this directly

Calls 3

wrapGLErrorFunction · 0.70
logFunction · 0.70
maxMethod · 0.45

Tested by

no test coverage detected