diff options
author | David Robillard <d@drobilla.net> | 2021-04-17 21:20:05 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-04-18 11:32:39 -0400 |
commit | e315b35531e070846f8613c34ee0776435c7bdd9 (patch) | |
tree | 9dec869c16c00de83f62ec33a4a3c510ea0aecfb /examples/pugl_embed_demo.c | |
parent | 51371e25da2a4930e525fb662ac5dc5cc2b115af (diff) | |
download | pugl-e315b35531e070846f8613c34ee0776435c7bdd9.tar.gz pugl-e315b35531e070846f8613c34ee0776435c7bdd9.tar.bz2 pugl-e315b35531e070846f8613c34ee0776435c7bdd9.zip |
Improve cube rendering in example programs
Diffstat (limited to 'examples/pugl_embed_demo.c')
-rw-r--r-- | examples/pugl_embed_demo.c | 11 |
1 files changed, 10 insertions, 1 deletions
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); |