人教小学信息第二册《图形变换》.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
* * * * * * * Manipulating Matrix Stacks (3) The depth of matrix stacks are implementation-dependent. The Modelview matrix stack is guaranteed to be at least 32 matrices deep. The Projection matrix stack is guaranteed to be at least 2 matrices deep. glGetIntegerv ( Glenum pname, Glint *parms ) Pname: GL_MAX_MODELVIEW_STACT_DEPTH GL_MAX_PROJECTION_STACT_DEPTH Demonstration (look at code) Demonstration (look at code) Demonstration (look at code) Let’s Examine Some Examples Question 1: Draw a simple solar system with a planet and a sun. Sun rotates around its own axis (Y axis) The planet rotates around its own axis (Y axis) The planet also rotates on its orbit around the sun. Example-1 Sun: Locates at the origin and rotates around its own axis (Y axis) M = Ry (q) Planet: 1. Rotates around its own axis. M1 = Ry (q) 2. Translate to its orbit. M2 = T (x, y, z) 3. Rotates around Sun. M3 = Ry (q) M = M3 M2 M1 OpenGL Implementation void main (int argc, char** argv) { glutInit ( argc, argv ); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize (500, 500); glutCreateWindow (Composite Modeling Transformation); init (); glutDisplayFunc (display); glutReshapeFunc (reshape); glutKeyboardFunc (keyboard); glutMainLoop (); } OpenGL Implementation void init (void) { glViewport(0, 0, 500, 500); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0, 1, 1.0, 20.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef (0.0, 0.0, -5.0); // viewing transform glClearColor(0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } OpenGL Implementation void display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); glPushMatrix(); // draw sun glPushMatrix(); glRotatef ((GLfloat) ang2, 0.0, 1.0, 0.0); glRotatef (90.0, 1.0,

文档评论(0)

sunache + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档