implement the complete stroke shader with custom blending mode

This commit is contained in:
2017-04-05 15:55:11 +01:00
parent dc693b2232
commit 9a4fd5e5c9
13 changed files with 265 additions and 46 deletions

View File

@@ -149,7 +149,29 @@ void Plane::create_impl(float w, float h, int div, GLushort *idx, Shape::vertex_
*idx++ = div; // D
*idx++ = 0; // A
}
void ui::Plane::update_vertices(const glm::vec4* data)
{
static vertex_t vertices[4];
vertices[0] = { data[0],{ 0, 0 } }; // A
vertices[1] = { data[1],{ 0, 1 } }; // B
vertices[2] = { data[2],{ 1, 1 } }; // C
vertices[3] = { data[3],{ 1, 0 } }; // D
glBindBuffer(GL_ARRAY_BUFFER, buffers[0]);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
static GLushort idx[6 + 8]{
0, 1, 2,
0, 2, 3,
0, 1,
1, 2,
2, 3,
3, 0,
};
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[1]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(idx), idx, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
void Circle::create_impl(float radius, int div, GLushort* idx, vertex_t* vertices)
{
count[0] = div * 3;