


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



IMPORTANT: State any (reasonable) assumption you make to complete the answer. A yes or no answer without explanation is worth 0 points. You may use the book(s). Write answers cleanly on the space provided. Use the back of the previous page if more space is needed. Clear sketches are encouraged.
[6] Describe, in a sentence or two, or using a sketch, the relationship of each of the following pairs of terms.
(A) Painter’s algorithm and z-buffering.
(B) Clipping and the viewing frustum.
(C) Bump mapping and surface normals.
(D) Bresenham’s algorithm and Nurbs curves.
(E) Minkowski sum and morphing.
(F) Simplex and icosahedron.
Consider the following control points
GLfloat ctrlpoints[2][3][4] = { {{{0.0, 0.0,2.0,2.0}, {0.0, 0.5,0.5,1.0}, {0.0, 1.0,0.0,1.0}}, {{1.0, 0.0,0.0,1.0}, {1.0,0.5,0.5,1.0}, {0.5, 0.5,0.5,0.5}}}};
and the definition of the corresponding B´ezier map
glMap2f(GL_MAP2_VERTEX_4, 0, 1, A, B, 0, 1, C, 2, &ctrlpoints[0][0][0]);
Give appropriate values for A, B and C (with comment). Compute the value of the surface at u = v = 1/2 using de Casteljau’s algorithm.
[2+2] A stencil application is defined as follows
GLfloat ctrlpoints[333] = { -1,-1,0, 0,-1.5,0, 1,-1,0, -1.5,0,0 , 0,0, 0, 1.5,0,0, -1, 1,0, 0, 1.5,0, 1,1,0 };
In init
glClearStencil(0x0); glEnable(GL_STENCIL_TEST); glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 3, 0, 1, 9, 3, &ctrlpoints[0]); glEnable(GL_MAP2_VERTEX_3); glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0);
In reshape
glClear(GL_STENCIL_BUFFER_BIT); glStencilFunc (GL_ALWAYS, 0x1, 0x1); glStencilOp (GL_REPLACE, GL_REPLACE, GL_REPLACE); glEvalMesh2(GL_FILL, 0, 20, 0, 20);
In display
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glStencilFunc (GL_EQUAL, 0x1, 0x1); glColor3f(1.0,0.0,0.0); glBegin(GL_QUADS); glVertex2f (-0.5, -0.5); glVertex2f ( 0.5, -0.5); glVertex2f ( 0.5, 0.5); glVertex2f (-0.5, 0.5); glEnd(); glStencilFunc (GL_NOTEQUAL, 0x1 , 0x1); glColor3f(0.0,0.0,1.0); glBegin(GL_QUADS); glVertex2f (-1.5, -1.5); glVertex2f ( 1.5, -1.5); glVertex2f ( 1.5, 1.5); glVertex2f (-1.5, 1.5); glEnd();
What is visible on the screen after reshape and display have been called? De- scribe shapes, specify colors!