From 5fc409c5d2e12f005f092fc83800a93a101dd567 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 7 Mar 2020 19:49:16 +0100 Subject: 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. --- test/pugl_test.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'test') 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 { -- cgit v1.2.1