§ Как он выглядит

clipboard.png

§ Какой у него код

init(gl)
{
    this.cls(0, 0, 0);

    let shader = this.loadShader();

    const vertices = [
        -1, -0.5,  3.0,
         1, -0.5,  3.0,
        -1, -0.5,  1.0,
         1, -0.5,  1.0,
    ];

    const colors = [
        1.0,  1.0,  1.0,  1.0,  // Белый
        1.0,  0.0,  0.0,  1.0,  // Красный
        0.0,  1.0,  0.0,  1.0,  // Зелёный
        0.0,  0.0,  1.0,  1.0   // Синий
    ];

    let vertexBuf = this.createBuffer(vertices);
    let colorsBuf = this.createBuffer(colors);

    this.addAttribute(shader, 'aPosition');
    this.addAttribute(shader, 'aColor');
    this.setAttribute(shader, vertexBuf, 'aPosition', 3);
    this.setAttribute(shader, colorsBuf, 'aColor', 4);

    this.setCameraUniform(shader, this.pcamera);

    gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
}