abdure
abdure
h>
#include <math.h>
void disp();
void drawStripe(float r, float g, float b, float yMin, float yMax) {
glColor3f(r, g, b); // set color for the stripe
glBegin(GL_QUADS); // draw a rectangle for the stripe
glVertex2f(-0.5f, yMin); // bottom left
glVertex2f(1.0f, yMin); // bottom right
glVertex2f(1.0f, yMax); // top right
glVertex2f(-0.5f, yMax); // top left
glEnd();
glFlush();
}
}
glEnd();
void disp() {
glClearColor(0, 0, 0, 0); // black background
glClear(GL_COLOR_BUFFER_BIT); // clear the color
glColor3f(0, 0, 1); // set color for the stripe
glBegin(GL_QUADS); // draw a rectangle for the stripe
glVertex2f(-0.5,1);
glVertex2f(-0.6,1);
glVertex2f(-0.6,-2);
glVertex2f(-0.5,-2);
glEnd();
// Draw the stripes of the Ethiopian flag
drawStripe(0, 0.5f, 0, 0.13f,o.8f); // green stripe
drawStripe(1, 0.8f, 0, -0.13f ,0.13f); // yellow stripe
drawStripe(1, 0, 0, -0.8f, -0.13f); // red stripe