From 84f9711489c7e6f644f17bdc1c398fb2403ebcd3 Mon Sep 17 00:00:00 2001 From: lerabot Date: Wed, 13 May 2020 10:16:29 -0400 Subject: [PATCH] Updated the blend samples --- samples/blend_test/main.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/samples/blend_test/main.c b/samples/blend_test/main.c index 4fcad50..65e58ec 100644 --- a/samples/blend_test/main.c +++ b/samples/blend_test/main.c @@ -63,23 +63,29 @@ void DrawGLScene() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); // Reset The View - glTranslatef(0, 0, -10.0f); // Move Left 1.5 Units And Into The Screen 6.0 - - glPushMatrix(); glTranslatef(-4.0, 0, -10); - DrawQuad(RED); - glPopMatrix(); - glTranslatef(4.0, 0, 0); + // LEFT SECTION + // This should draw 2 quad, a red first, then and overlapping blue one. + // This section draw both quad at the same Z value glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - /* Draw 3 overlapping quads, 2 of which should be totally transparent so the - * output should be the third */ - DrawQuad(NONE); - DrawQuad(NONE); + DrawQuad(RED); + glTranslatef(1.0, 0, 0); DrawQuad(BLUE); + glDisable(GL_BLEND); + glTranslatef(4.0, 0, 0); + + // RIGHT SECTION + // This should draw 2 quad, a red first, then and overlapping blue one. + // This section uses a LOWER Z VALUE(-0.01f), so the blue quad should be in FRONT of the red quad. + // lerabot's note : changing the z value to positive gives the desired output. + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + DrawQuad(RED); + glTranslatef(1.0, 0, -0.01); + DrawQuad(BLUE); glDisable(GL_BLEND); glKosSwapBuffers();