wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Computer graphic 2

Total questions: 5

Worksheet time: 3mins

Name
Class
Date
1.

What is the output of following codes?

glLineWidth(p);

glBegin(GL_LINES);

glVertex2d(x1, y1); glVertex2d(x2, y2);

glVertex2d(x3, y3); glVertex2d(x4, y4);

glEnd()

a)

1 line

b)

1 rectangle

c)

4 lines

d)

2 lines

2.

What is the following line drawing algorithm?

int h = by-ay;

int w = bx-ax;

float F = h-w/2;

int y = ay;

for (int x=ax; x<=bx; x++)

{ setPixel(x, y);

if(F < 0) F += h;

else { F += h-w; y++; }

}

a)

Analytical method

b)

Midpoint Algorithm

c)

Bresenham’s Algorithm

d)

None of the above

3.

Set of attributes to draw a line is (are) (select all that apply):

a)

Color

b)

Thickness

c)

Type

d)

Size

4.

Bresenham's algorithm is an improved method of midpoint algorithm.

a)

Yes

b)

No

5.

To diminish the jag edges of the line, the following OpenGL command can be applied:

a)

glEnable (GL_SMOOTH);

b)

glEnable (GL_LINE_SMOOTH);

c)

glDisable (GL_LINE_JAGGED);

d)

glDisable (GL_JAGGED);