aboutsummaryrefslogtreecommitdiffstats
path: root/test/pugl_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-07 19:49:16 +0100
committerDavid Robillard <d@drobilla.net>2020-03-07 19:59:15 +0100
commit5fc409c5d2e12f005f092fc83800a93a101dd567 (patch)
tree4d5117a1d202a5ffe778686ae844db228a34aae4 /test/pugl_test.c
parente5c80c7a473139c4416c0ede2d38b6fa2107435f (diff)
downloadpugl-5fc409c5d2e12f005f092fc83800a93a101dd567.tar.gz
pugl-5fc409c5d2e12f005f092fc83800a93a101dd567.tar.bz2
pugl-5fc409c5d2e12f005f092fc83800a93a101dd567.zip
Test: Don't reuse cube vertices for background
This was pretty confusing since it looked like the parent view was drawing the cube as well, and inefficient since only a single rect needs to be drawn here.
Diffstat (limited to 'test/pugl_test.c')
-rw-r--r--test/pugl_test.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/pugl_test.c b/test/pugl_test.c
index ba25757..4c0498d 100644
--- a/test/pugl_test.c
+++ b/test/pugl_test.c
@@ -52,6 +52,13 @@ typedef struct
bool verbose;
} PuglTestApp;
+static const float backgroundVertices[] = {
+ -1.0f, 1.0f, -1.0f, // Top left
+ 1.0f, 1.0f, -1.0f, // Top right
+ -1.0f, -1.0f, -1.0f, // Bottom left
+ 1.0f, -1.0f, -1.0f, // Bottom right
+};
+
static PuglRect
getChildFrame(const PuglRect parentFrame)
{
@@ -220,9 +227,9 @@ onParentEvent(PuglView* view, const PuglEvent* event)
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, cubeStripVertices);
- glColorPointer(3, GL_FLOAT, 0, cubeStripVertices);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 14);
+ glVertexPointer(3, GL_FLOAT, 0, backgroundVertices);
+ glColorPointer(3, GL_FLOAT, 0, backgroundVertices);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
} else {