Updated the blend samples

This commit is contained in:
lerabot 2020-05-13 10:16:29 -04:00
parent c66f34cc62
commit 84f9711489

View File

@ -63,23 +63,29 @@ void DrawGLScene()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View 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); 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); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
DrawQuad(RED);
/* Draw 3 overlapping quads, 2 of which should be totally transparent so the glTranslatef(1.0, 0, 0);
* output should be the third */
DrawQuad(NONE);
DrawQuad(NONE);
DrawQuad(BLUE); 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); glDisable(GL_BLEND);
glKosSwapBuffers(); glKosSwapBuffers();