if (options.color === true) {
var texture = Texture2D.create(width, height, options);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, texture.target, texture.handle, 0);
this.colorAttachments.push(texture);
this.colorAttachmentsPositions.push(gl.COLOR_ATTACHMENT0);
}
else if (options.color.length !== undefined && options.color.length > 0) {
options.color.forEach(function(colorBuf, colorBufIndex) {
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + colorBufIndex, colorBuf.target, colorBuf.handle, 0);
this.colorAttachments.push(colorBuf);
this.colorAttachmentsPositions.push(gl.COLOR_ATTACHMENT0 + colorBufIndex);
}.bind(this));
}
else if (options.color !== false) {
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, options.color.target, options.color.handle, 0);
this.colorAttachments.push(options.color);
this.colorAttachmentsPositions.push(gl.COLOR_ATTACHMENT0);
}