Why is the upper left corner always black?

I have such a Tessellator:

#include "Tessellator.h"

Tessellator::~Tessellator() {
    delete vertexFormat;
}

Tessellator* Tessellator::Color(float r, float g, float b, float a) {
    colors.push_back(r);
    colors.push_back(g);
    colors.push_back(b);
    colors.push_back(a);

    return this;
}

Tessellator* Tessellator::Tex(float u, float v) {
    texCoords.push_back((GLfloat) u);
    texCoords.push_back((GLfloat) v);

    return this;
}

Tessellator* Tessellator::Begin(int primitiveMode) {
    if (drawing)
        throw std::runtime_error("Already drawing");

    this->primitiveMode = primitiveMode;
    this->drawing = true;
    return this;
}

void Tessellator::Draw() {
    if (!drawing)
        throw std::runtime_error("Isn't drawing");
    
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);

    glVertexPointer(2, GL_FLOAT, 0, &vertices[0]);
    glColorPointer(4, GL_FLOAT, 0, &colors[0]);

    glDrawArrays(primitiveMode, 0, static_cast<GLsizei>(vertices.size() / 2));

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);

    this->vertices.clear();
    this->colors.clear();
    this->drawing = false;
}

Tessellator* Tessellator::Vertex(float x, float y) {
    vertices.push_back((GLfloat) x);
    vertices.push_back((GLfloat) y);

    return this;
}

Usage:

glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glDisable(GL_ALPHA_TEST);

    glShadeModel(GL_SMOOTH);
    tessellator->Begin(GL_QUADS);
    tessellator->Color(0.0f, 0.0f, 1.0f)->Vertex(0, 0);
    tessellator->Color(0.0f, 0.0f, 1.0f)->Vertex(width, 0);
    tessellator->Color(1.0f, 1.0f, 0.0f)->Vertex(width, height);
    tessellator->Color(1.0f, 1.0f, 0.0f)->Vertex(0, height);
    tessellator->Draw();
    glShadeModel(GL_FLAT);

    glDisable(GL_BLEND);
    glEnable(GL_ALPHA_TEST);

But instead of a successful result, I get delirium (bug) every time (sometimes I get the right result).
This is due to glShadeModel(GL_SMOOTH):
image

For better feedback, don’t show all your GL wrapping code. Show the raw GL calls that are being made with the value parameters being provided. Use a GL call trace capture utility for this if you need to.

As-is, this won’t even compile. You’re only providing 3 parameters to a function that accepts 4.

Somehow, it appears that you’re providing the color black for the first vertex. Or there’s a bug in quad rendering for the GL driver you’re using.

What GPU and GPU driver is this on? Run this and it’ll tell you:

Under-the-hood, GL_QUADS rendering is just using triangles. Try GL_TRIANGLE_STRIP or GL_TRIANGLES and see if you get different results.