http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/?fbclid=IwAR15jWvGldrlKJDcrpnuYpWluaE7Du-cjQEc3-supSbl5zcvFO88EetTAzw
data+win32+glut32.dll 先下載並放好
差別1 (以自己為中心-自己轉)
glTranslatef ///把圖放大縮小後做旋轉在移動
glRotatef ///把圖放大縮小後做旋轉
glScalef ///把圖放大縮小
glBegin ///開始畫圖
差別2 (以其他地方為中心-公轉)
glRotatef ///把圖放大縮小後做移動然後在旋轉
glTranslatef ///把圖放大縮小後做移動
glScalef ///把圖放大縮小
glBegin ///開始畫圖
https://www.transmissionzero.co.uk/software/freeglut-devel/
freeglut 3.0.0 MinGW Package 下載
#include <GL/glut.h>
float angle=0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0,0.5,0);
glutWireTeapot(0.3);
glPopMatrix();
glPushMatrix();
glTranslatef(0.51,0.64,0);
glRotatef(angle,0,0,1);
glTranslatef(0.6,0,0);
glRotatef(-90,0,1,0);
glutWireCone(0.1,0.6,10,10);
glPopMatrix();
glutSwapBuffers();
}
void motion(int x,int y)
{
angle = x;
display();
}
int main(int argc, char ** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week10-TRT");
glutDisplayFunc(display);
glutMotionFunc(motion);
glutMainLoop();
}
沒有留言:
張貼留言