summaryrefslogtreecommitdiff
path: root/src/shader/linejoin_shader.cpp
blob: 050e180e00eda53c1a6f416f8b52b2bf9dd22ecb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <mbgl/shader/linejoin_shader.hpp>
#include <mbgl/shader/shaders.hpp>
#include <mbgl/platform/gl.hpp>

#include <cstdio>

using namespace mbgl;

LinejoinShader::LinejoinShader()
    : Shader(
        "linejoin",
        shaders[LINEJOIN_SHADER].vertex,
        shaders[LINEJOIN_SHADER].fragment
    ) {
    if (!valid) {
        fprintf(stderr, "invalid line shader\n");
        return;
    }

    a_pos = glGetAttribLocation(program, "a_pos");
}

void LinejoinShader::bind(char *offset) {
    glEnableVertexAttribArray(a_pos);
    // Note: We're referring to the vertices in a line array, which are 8 bytes long!
    glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 8, offset);
}