aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-12-07 18:44:02 +0100
committerDavid Robillard <d@drobilla.net>2019-12-11 23:09:46 +0100
commit7568f5caec1c7bed95ee93c23a7b9b552a7b9833 (patch)
treef903693569a14b1f50ed9adad01c94658f493816
parent731fa0d59fc269e00d1f499c49aa3804a30c5b8a (diff)
downloadpugl-7568f5caec1c7bed95ee93c23a7b9b552a7b9833.tar.gz
pugl-7568f5caec1c7bed95ee93c23a7b9b552a7b9833.tar.bz2
pugl-7568f5caec1c7bed95ee93c23a7b9b552a7b9833.zip
GL3 Test: Spread out rectangles more
-rw-r--r--test/pugl_gl3_test.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/pugl_gl3_test.c b/test/pugl_gl3_test.c
index 672dc65..95fa54d 100644
--- a/test/pugl_gl3_test.c
+++ b/test/pugl_gl3_test.c
@@ -152,15 +152,19 @@ onExpose(PuglView* view)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, app->ibo);
for (size_t i = 0; i < app->numRects; ++i) {
- Rect* rect = &app->rects[i];
+ Rect* rect = &app->rects[i];
+ const float normal = i / (float)app->numRects;
+ const float offset[2] = {normal * 128.0f, normal * 128.0f};
// Move rect around in an arbitrary way that looks cool
- rect->pos[0] = (float)(frame.width - rect->size[0]) *
- (sinf((float)time * rect->size[0] / 64.0f) + 1.0f) /
- 2.0f;
- rect->pos[1] = (float)(frame.height - rect->size[1]) *
- (cosf((float)time * rect->size[1] / 64.0f) + 1.0f) /
- 2.0f;
+ rect->pos[0] =
+ (float)(frame.width - rect->size[0] + offset[0]) *
+ (sinf((float)time * rect->size[0] / 64.0f + normal) + 1.0f) /
+ 2.0f;
+ rect->pos[1] =
+ (float)(frame.height - rect->size[1] + offset[1]) *
+ (cosf((float)time * rect->size[1] / 64.0f + normal) + 1.0f) /
+ 2.0f;
drawRect(app, rect, proj);
}