From e315b35531e070846f8613c34ee0776435c7bdd9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 17 Apr 2021 21:20:05 -0400 Subject: Improve cube rendering in example programs --- examples/pugl_embed_demo.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'examples/pugl_embed_demo.c') diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c index 0e12ddb..79e7505 100644 --- a/examples/pugl_embed_demo.c +++ b/examples/pugl_embed_demo.c @@ -48,12 +48,21 @@ typedef struct { } PuglTestApp; // clang-format off + 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 const float backgroundColorVertices[] = { + 0.25f, 0.75f, 0.25f, // Top left + 0.75f, 0.75f, 0.25f, // Top right + 0.25f, 0.25f, 0.25f, // Bottom left + 0.75f, 0.25f, 0.25f, // Bottom right +}; + // clang-format on static PuglRect @@ -177,7 +186,7 @@ onParentEvent(PuglView* view, const PuglEvent* event) glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glVertexPointer(3, GL_FLOAT, 0, backgroundVertices); - glColorPointer(3, GL_FLOAT, 0, backgroundVertices); + glColorPointer(3, GL_FLOAT, 0, backgroundColorVertices); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); -- cgit v1.2.1