Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following is a code block in OpenGL #include void display(void) { /*clear al

ID: 3850800 • Letter: T

Question

The following is a code block in OpenGL #include void display(void) { /*clear all pixels */ glClear(GL_COLOR_BUFFER_BIT): /*draw white polygon (rectangle) with corners at * (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0) /* glColor3f (1.0, 1.0, 1.0): glBegin(GL_POLYGON): glVertex3f (0.25, 0.25, 0.0): glVertex3f (0.75, 0.25, 0.0): glVertex3f (0.75, 0.75, 0.0): glVertex3f (0.25, 0.75, 0.0): glEnd(): /* don't wait! * start processing buffered OpenGL routines /* glFlush(): } i) Explain the function of openGL software ii) What is the purpose of the code block presented iii) What is the function of each statement in the code block

Explanation / Answer

Ans 1. The full form of openGL is Open Graphics Library. It is an application proggramming interface(API) which is cross language and cross platform. It used to used to render vector graphics in 2D or 3D.The application interacts with the GPU.

Ans 2. The block of code shown draws a 2-dimensional white coloured rectangle with edges at (0.25,0.25) and (0.75,0.75).

Ans 3. 1st line: Imports the functions from the header file specified to be used in the program.

2nd line: Creates a function display with return type void

3rd line: 3rd line clears the output screen.

4th line: Specifies the color with which the following pixels are to be drawn.

5th line: Calls the function that would draw lines to make a polygon

6th,7th,8th,9th line: Makes lines to form a rectangle

10th: Ends the polygon making process

11th: Forces execution of gl functions in finite time