Question
GIVE ME THE OUTPUT/IMAGE OF THE CODE BELOW #include void init() { glClearColor(1.0, 1.0, 1.0, 1.0); // set background color to white glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0,
GIVE ME THE OUTPUT/IMAGE OF THE CODE BELOW #include
void init()
{
glClearColor(1.0, 1.0, 1.0, 1.0); // set background color to white
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 512.0, 512.0, 0.0, -1.0, 1.0);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT); // clear the screen
// Mark
// Draw Background
glBegin(GL_QUADS);
glColor3f(0.0, 0.7, 1.0); // blue
glVertex2f(0.0, 0.0);
glVertex2f(0.0, 512.0);
glVertex2f(512.0, 512.0);
glVertex2f(512.0, 0.0);
glEnd();
// Draw Object
glBegin(GL_QUADS);
glColor3f(1.0, 1.0, 0.0); // yellow
glVertex2f(100.0, 100.0);
glVertex2f(100.0, 150.0);
glVertex2f(150.0, 150.0);
glVertex2f(150.0, 100.0);
glEnd();
// Draw Mario
glBegin(GL_QUADS);
glColor3f(1.0, 0.0, 0.0); // red
glVertex2f(250.0, 250.0);
glVertex2f(250.0, 300.0);
glVertex2f(300.0, 300.0);
glVertex2f(300.0, 250.0);
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(512, 512);
glutCreateWindow("Super Mario Bros");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started