《图形学实验一.doc》由会员分享,可在线阅读,更多相关《图形学实验一.doc(3页珍藏版)》请在金锄头文库上搜索。
1、Computer Graphics: Assignment 1A Exercises (Submission date: Sep. 23, 2010)1 Given a quad mesh as follows (obj format)# A cubev 1 0 0v 1 1 0v 1 1 1v 1 0 1v 0 0 0v 0 1 0v 0 1 1v 0 0 1f 1 2 3 4f 2 6 7 3f 5 8 7 6f 1 4 8 5f 3 7 8 4f 1 5 6 2Please give the result after first round of Catmull-Clark subdiv
2、ision in the form of obj format.2 Given a triangular mesh as follows (obj format)# A tetrahedronv 1 0 0v 0 1 0v 0 0 1v 0 0 0v 0 0 0f 1 2 3f 2 4 3f 1 3 4f 1 4 2Please give the result after first round of Loop subdivision in the form of obj format.3 pp. 526, 8-244 pp. 527 8-35B Experiment:(Submission
3、date: Sep. 23, 2010)1. Please download and install the glut library. 2. Write a complete program using the following codes to draw a Sierpinski gasket.void myinit()/ attributesglClearColor(1.0,1.0,1.0,1.0);glColor3f(1.0,0.0,0.0); / set up viewingglMatrixMode(GL_PROJECTION);glLoadIdentity();gluOrtho2
4、D(0.0, 50.0,0.0,50.0);glMatrixMode(GL_MODELVIEW);void display()GLfloat vertices33 = 0.0,0.0,0.0, 25.0, 50.0,0.0, 50.0,0.0,0.0;/ an arbitrary triangle in the plane z = 0;GLfloat p3 = 7.5, 5.0, 0.0; / or set to any desired initial point inside the triangle;int j,k;int rand();glBegin(GL_POINTS);for (k
5、= 0; k 5000; k+) /* pick a random vertex from 0,1,2*/ j = rand()%3; / compute new location;p0 = (p0+verticesj0)/2;p0 = (p1+verticesj1)/2; / display new point glVertex3fv(p);glEnd();glFlush();#include void main(int argc, char *argv)glutInit(&argc, argv);glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);glutI
6、nitAWindowSize(500,500);glutInitWindowPosition(0,0);glutCreateWindow(“Simple OpenGL Example”);glutDisplayFunc(display);myinit();glutMainLoop(); 3. Given a closed control polygon with n vertices, please write a program to draw its 2D 4-point interpolatory subdivision curve. 注:1)请按时完成作业和实验,一时完不成请当面向老师说明,推迟超过一星期的话,将没有成绩;2)作业要书面提交;实验则可以提交电子或纸质文档;3)发现抄袭的作业,则不管谁抄谁,一律取消本次作业成绩;触犯校规的将按校规处理;网上找到的信息,也要用自己的语言组织描述,不能照抄。