OpenGL Russia Flag Code

Screen:


Code:

#include<GL/glut.h>

void display()
{
    glClearColor(1,1,1,0);
    glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(1,1,1);
    glRectf(1,11,30,22);

    glColor3f(255,0,0);
    glRectf(1,1,30,8);

    glColor3f(0,0,1);
    glRectf(1,8,30,15);

    glFlush();
}
int main(int argc, char ** argv)
{
    glutInit(&argc, argv);
    glutInitWindowPosition(50,50);
    glutInitWindowSize(640,640);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutCreateWindow("Drawing rectangles");

    glMatrixMode(GL_PROJECTION);
    gluOrtho2D(-5,35,-5,30);
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}
1 Like

Made By Paraskoslev From Greece !!!

CodeBlocks Version 13.12
I dont know if it will work for any version maybe you have to include something else idk i dont use any other version this is for school project

well done @Paraskoslev, but shouldn’t you have given the flag a black background. To contrast the white part of it?

1 Like

uhm i have the knowledge how to do that :stuck_out_tongue: this is a school project and i just “edit” from a allready code

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.