2022年5月10日 星期二

A

WEEK12

1. 在下方Command manipulation window視窗右鍵可以swap 移動(translate)跟轉動(rotate)。

2.自轉


3.公轉


1.在 https://jsyeh.org/3dcg10,下載data , win32

2.解壓縮,把data放到windows裡

3.開Transformation.exe



#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.4,0.15,0);///3.把它往右放
glRotatef(angle,0,0,1);///2.旋轉
glTranslatef(0.2,0,0);///1.旋轉中心放到世界中心,希望 手茶壺的中心旋轉軸 在把手位置,因大小是0.2,才往右0.2
glColor3f(1,0,0);
glutSolidTeapot( 0.2 );///紅身體
glPopMatrix();
glutSwapBuffers();
angle+=0.1;
} int main(int argc,char ** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("week12");
glutIdleFunc(display);
glutDisplayFunc(display);
glutMainLoop();
}





沒有留言:

張貼留言

VERY BEAUTIFUL, VERY POWERFUL

一.     一樣先安裝且設定好freeglut,OpecCV, 開啟CodeBlocks建立新專案 week11_gundam,                 把 MyGundam.zip下載解壓縮後的data資料夾放到freeglut/bin裡面 把week09_openc...