summaryrefslogtreecommitdiff
path: root/src/mbgl/shader/raster_shader.cpp
blob: eb431cd5dba1c5a6f6bcd3db0b8d795dc9d7dc1d (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
#include <mbgl/shader/raster_shader.hpp>
#include <mbgl/shader/raster.vertex.hpp>
#include <mbgl/shader/raster.fragment.hpp>
#include <mbgl/gl/gl.hpp>

namespace mbgl {

RasterShader::RasterShader(gl::ObjectStore& store, bool overdraw)
    : Shader(shaders::raster::name,
             shaders::raster::vertex,
             shaders::raster::fragment,
             store, overdraw) {
}

void RasterShader::bind(GLbyte* offset) {
    const GLint stride = 8;

    MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
    MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, stride, offset));

    MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_texture_pos));
    MBGL_CHECK_ERROR(glVertexAttribPointer(a_texture_pos, 2, GL_SHORT, false, stride, offset + 4));
}

} // namespace mbgl