1、
2、https://120.125.80.50/GL/opengl_TRT_demo.html
了解T-R-T的操作
#include <GL/glut.h> float angle=0; void display() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glColor3f(1,1,1);///白色的 glutSolidTeapot( 0.3 );///大茶壼 glPushMatrix(); glTranslatef(0.3, 0, 0);///把下面旋轉中的東西 "掛在" 某處 glRotatef( angle, 0,0,1 );///旋轉 glTranslatef(0.2, 0, 0);///往右下移動(把把手移到中心) glColor3f(1,0,0);///紅色的 glutSolidTeapot( 0.2 );///茶壼 glPopMatrix(); glutSwapBuffers(); angle+=0.1; }
#include <GL/glut.h> float angle=0; void display() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glColor3f(1,1,1);///白色的 glutSolidTeapot( 0.3 );///大茶壼 glPushMatrix(); glTranslatef(0.3, 0, 0);///把下面旋轉中的東西 "掛在" 某處 glRotatef( angle, 0,0,1 );///旋轉 glTranslatef(0.2, 0, 0);///往右下移動(把把手移到中心) glColor3f(1,0,0);///紅色的 glutSolidTeapot( 0.2 );///茶壼 glPushMatrix(); glTranslatef(0.2, 0, 0);///把下面旋轉中的東西 "掛在" 某處 glRotatef( angle, 0,0,1 );///旋轉 glTranslatef(0.2, 0, 0);///往右下移動(把把手移到中心) glColor3f(1,0,0);///紅色的 glutSolidTeapot( 0.2 );///茶壼 glPopMatrix(); glPopMatrix(); glutSwapBuffers(); angle+=0.03; }
沒有留言:
張貼留言