Skip to content
Snippets Groups Projects
Commit 8e5df672 authored by Philip Trettner's avatar Philip Trettner
Browse files

more 2D samples

parent ae6ed8ad
No related branches found
No related tags found
No related merge requests found
glow @ a0f72756
Subproject commit aaf5f23b57cfd260efdaa2c1e7787415e9960c86
Subproject commit a0f727567041516347439d73795636d1aee12df2
glow-extras @ 4a664b55
Subproject commit 22266479a99ff82946ee7eb698166a548fcf77c9
Subproject commit 4a664b557fb3e417b85d5b6eb4ca1e5f72df78d6
polymesh @ 6c22fa03
Subproject commit 8780b1de6fe379af2f0162d68f26de2fb55ea52c
Subproject commit 6c22fa0315f450b7dbd48b5555fbbff2a80c6bcd
......@@ -45,11 +45,56 @@ void Vector2DSample::render(float elapsedSeconds)
glow::vector::image2D img;
auto g = graphics(img);
g.draw(tg::pos2(100, 100), {tg::color3::blue, 5.0f});
// ways to specify a brush
g.draw(tg::pos2(100, 100), tg::color3::blue);
g.draw(tg::pos2(110, 100), tg::color4::blue);
g.draw(tg::pos2(120, 100), {1, 0, 0});
g.draw(tg::pos2(130, 100), {1, 0, 0, 1});
g.draw(tg::pos2(140, 100), {tg::color3::blue, 5.0f});
g.draw(tg::pos2(150, 100), {tg::color4::blue, 5.0f});
g.draw(tg::pos2(160, 100), {{1, 0, 0}, 5.0f});
g.draw(tg::pos2(170, 100), {{1, 0, 0, 1}, 5.0f});
// ways to speficy a fill
g.fill(tg::aabb2({100, 120}, {150, 125}), tg::color3::green);
g.fill(tg::aabb2({100, 130}, {150, 135}), tg::color4::green);
g.fill(tg::aabb2({100, 140}, {150, 145}), {1, 0, 0});
g.fill(tg::aabb2({100, 150}, {150, 155}), {1, 0, 0, 1});
// line drawings
g.draw(tg::segment2({110, 100}, {80, 80}), tg::color3::red);
g.fill(tg::aabb2({70, 10}, {100, 20}), tg::color3::green);
g.draw(tg::aabb2({70, 10}, {100, 20}), {{0, 0, 0}, 3});
// fillings
// other objects
{
float x = 250;
float y = 100;
auto next = [&] {
x += 100;
if (x > 1000)
{
x = 250;
y += 100;
}
};
g.draw(tg::aabb2({x - 20, y - 10}, {x + 20, y + 10}), {{0, 0, 0}, 3});
g.fill(tg::aabb2({x - 20, y - 10}, {x + 20, y + 10}), tg::color3::green);
next();
g.draw(tg::triangle2({x - 20, y - 10}, {x + 10, y - 20}, {x, y + 20}), {{0, 0, 0}, 2});
g.fill(tg::triangle2({x - 20, y - 10}, {x + 10, y - 20}, {x, y + 20}), {0, 0, 1});
next();
g.draw(tg::sphere2({x, y}, 15.f), {{0, 0, 0}, 2});
g.fill(tg::sphere2({x, y}, 15.f), {0, 0, 1});
next();
g.draw(tg::circle2({x, y}, 15.f), {{0, 0, 0}, 2});
g.fill(tg::circle2({x, y}, 15.f), {0, 0, 1});
next();
}
// TODO: more
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment