<commit_before>var createBuffer = require('gl-buffer')
var createVAO = require('gl-vao')

function Quad(gl) {
    if (!(this instanceof Quad))
        return new Quad(gl)
    this.gl = gl

    this.vertices = createBuffer(gl, 
                new Float32Array([-1, -1,
                    -1, 1,
                    1, 1,
                    1, -1]), 
                gl.ARRAY_BUFFER, 
                gl.STATIC_DRAW)

    this.texcoords = createBuffer(gl, 
                new Float32Array([0, 1,
                    0, 0,
                    1, 0,
                    1, 1]), 
                gl.ARRAY_BUFFER, 
                gl.STATIC_DRAW)

    this.elements = createBuffer(gl, 
                new Uint16Array([0, 1, 2, 0, 2, 3]), 
                gl.ELEMENT_ARRAY_BUFFER,
                gl.STATIC_DRAW)

    this.vao = createVAO(gl, [
        { 
            buffer: this.vertices,
            size: 2,
            noramlized: false,
        },
        {
            buffer: this.texcoords,
            size: 2,
            normalized: false
        }
    ], this.elements)

}

Quad.prototype.draw = function(shader) {
    if (shader) 
        shader.bind()
    this.vao.bind()
    this.vao.draw(gl.TRIANGLES, 6)
    this.vao.unbind()
}

Quad.prototype.dispose = function() {
    this.vertices.dispose()
    this.texcoords.dispose()
    this.elements.dispose()
    this.vao.dispose()
    this.gl = null
}

module.exports = Quad<commit_msg>add missing ref to this.gl<commit_after>var createBuffer = require('gl-buffer')
var createVAO = require('gl-vao')

function Quad(gl) {
    if (!(this instanceof Quad))
        return new Quad(gl)
    this.gl = gl

    this.vertices = createBuffer(gl, 
                new Float32Array([-1, -1,
                    -1, 1,
                    1, 1,
                    1, -1]), 
                gl.ARRAY_BUFFER, 
                gl.STATIC_DRAW)

    this.texcoords = createBuffer(gl, 
                new Float32Array([0, 1,
                    0, 0,
                    1, 0,
                    1, 1]), 
                gl.ARRAY_BUFFER, 
                gl.STATIC_DRAW)

    this.elements = createBuffer(gl, 
                new Uint16Array([0, 1, 2, 0, 2, 3]), 
                gl.ELEMENT_ARRAY_BUFFER,
                gl.STATIC_DRAW)

    this.vao = createVAO(gl, [
        { 
            buffer: this.vertices,
            size: 2,
            noramlized: false,
        },
        {
            buffer: this.texcoords,
            size: 2,
            normalized: false
        }
    ], this.elements)

}

Quad.prototype.draw = function(shader) {
    if (shader) 
        shader.bind()
    this.vao.bind()
    this.vao.draw(this.gl.TRIANGLES, 6)
    this.vao.unbind()
}

Quad.prototype.dispose = function() {
    this.vertices.dispose()
    this.texcoords.dispose()
    this.elements.dispose()
    this.vao.dispose()
    this.gl = null
}

module.exports = Quad
{'fraction_non_alphanumeric': 0.11752577319587629, 'fraction_numerical': 0.021305841924398626, 'mean_word_length': 1.3381526104417671, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2687497', 'n_tokens_mistral': 1013, 'n_tokens_neox': 912, 'n_words': 179}