Font size
WorksheetsComputer graphic 2
Total questions: 5
Worksheet time: 3mins
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()
1 line
1 rectangle
4 lines
2 lines
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++; }
}
Analytical method
Midpoint Algorithm
Bresenham’s Algorithm
None of the above
Set of attributes to draw a line is (are) (select all that apply):
Color
Thickness
Type
Size
Bresenham's algorithm is an improved method of midpoint algorithm.
Yes
No
To diminish the jag edges of the line, the following OpenGL command can be applied:
glEnable (GL_SMOOTH);
glEnable (GL_LINE_SMOOTH);
glDisable (GL_LINE_JAGGED);
glDisable (GL_JAGGED);
