Files
MapLibreParticleLab/src/shader/linejoin_shader.cpp
2014-09-04 16:22:25 -07:00

28 lines
689 B
C++

#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);
}