readPixels(isOnHotPath=true) {
        const GL = WebGLRenderingContext;
        if (!this._hasBeenRenderedTo) {
            throw new Error("Called readPixels on a texture that hasn't been rendered to.");
        }

        let outputBuffer;
        switch (this.pixelType) {
            case GL.UNSIGNED_BYTE:
                outputBuffer = new Uint8Array(this.width * this.height * 4);
                break;
            case GL.FLOAT:
                outputBuffer = new Float32Array(this.width * this.height * 4);
                break;
            default:
                throw new Error("Unrecognized pixel type.");
        }

        if (this.width === 0 || this.height === 0) {
            return outputBuffer;
        }

        let gl = initializedWglContext().gl;
        gl.bindFramebuffer(GL.FRAMEBUFFER, this.initializedFramebuffer());
        checkGetErrorResult(gl, "framebufferTexture2D", isOnHotPath);
        checkFrameBufferStatusResult(gl, isOnHotPath);
        gl.readPixels(0, 0, this.width, this.height, GL.RGBA, this.pixelType, outputBuffer);
        checkGetErrorResult(gl, `readPixels(..., RGBA, ${this.pixelType}, ...)`, isOnHotPath);

        return outputBuffer;
    }
Performs a blocking read of the pixel color data in this texture.
@param {!boolean} isOnHotPath
@returns {!Uint8Array|!Float32Array}