2019年3月15日 星期五

謝謝小葉讓_week04

今日課程內容:




1.按照老方法開啟glut

更改libfreeglut.a名字為libglut32.a等等....
每次都要改這個真的有點煩了....

⣿⣿⣿⣿⠟⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠒⠻⣿⣿⣿⣿⣿⣿ ⣿⡿⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠹⣿⣿⣿ ⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⠁⠨⢻⣿ ⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣰⣾⣾⣿⣷⣤⡀⠄⠄⠄⠄⠄⠄⠄⠈⣿ ⠄⠄⠄⠄⠄⠄⠄⠄⠄⣀⣠⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣦⣄⠄⠄⠄⠄⠄⠄⢸ ⠄⠄⠄⠄⠄⢀⡴⠶⡿⠛⠛⠛⠛⢿⣿⣿⣿⣿⡟⠉⣉⣉⣉⣁⣀⡀⠄⠄⠄⠈ ⠄⠄⠄⠄⠴⠏⣚⣻⣯⣭⣭⣭⣤⣄⡛⠛⠛⠛⣫⣽⣶⣶⣶⣿⣷⣄⠄⠄⠄⢰ ⠄⢀⣰⣇⣀⣾⣿⡿⠿⠟⠛⠙⠻⣿⡇⢸⣿⠧⢹⣿⢁⣀⡠⢉⣹⣿⡀⡆⠄⢸ ⠄⢋⣉⣿⣿⣌⣧⣴⣶⣶⣶⣯⣶⡿⣳⣿⣷⣾⣧⣿⠿⠿⠿⠿⢿⣿⣫⣾⡀⢀ ⠄⢸⣿⣿⣿⣿⣶⣾⣿⣿⣷⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠈ ⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣵⠿⠿⢿⢿⡿⠟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣀ ⣤⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⠆⣀⣠⣼⣤⣄⣺⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠉⠿⠿⠿⠿⢿⣛⣛⡋⠉⠉⢹⣿⣿⣿⣿⣿ ⣘⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣼⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⠿⢿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿

2.開啟Transformation

2.下載三個檔案:data,win32,glut32.dll

 

3..將"glut32.dll"與"data"的檔案放入windows解壓縮完的資料夾並執行"Transformation.exe"


3.產生上次可用滑鼠拖曳的茶壺

1.程式碼

#include <GL/glut.h>
float x=0,y=0;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);///清除背景
    glPushMatrix();///備份矩陣
        glTranslatef((x-150)/150.0,-(y-150)/150.0,0);
        glutSolidTeapot(0.3);
    glPopMatrix();///還原矩陣
    glutSwapBuffers();
}
void motion(int nowx,int nowy)
{
    x=nowx;
    y=nowy;
    display();
}
int main(int argc, char**argv)
{
    glutInit(&argc ,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("隱睪盛");///開啟的視窗名稱
    glutDisplayFunc(display);
    glutMotionFunc(motion);
    glutMainLoop();
}

2.更改程式碼使茶壺能夠旋轉

旋轉x軸方向:

#include <GL/glut.h>
float x=0,y=0;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);///清除畫面,只留新的
    glPushMatrix();///備份矩陣
        glRotatef(x,0,1,0);///更改x軸(只改了這行)
        ///glTranslatef((x-150)/150.0,-(y-150)/150.0,0);
        glutSolidTeapot(0.3);
    glPopMatrix();///還原矩陣
    glutSwapBuffers();
}
void motion(int nowx,int nowy)
{
    x=nowx;
    y=nowy;
    display();
}
int main(int argc, char**argv)
{
    glutInit(&argc ,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("week04");
    glutDisplayFunc(display);
    glutMotionFunc(motion);
    glutMainLoop();
}

旋轉y軸方向:

#include <GL/glut.h>
float x=0,y=0;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);///清除畫面,只留新的
    glPushMatrix();///備份矩陣
        glRotatef(y,1,0,0);///更改y軸
        ///glTranslatef((x-150)/150.0,-(y-150)/150.0,0);
        glutSolidTeapot(0.3);
    glPopMatrix();///還原矩陣
    glutSwapBuffers();
}
void motion(int nowx,int nowy)
{
    x=nowx;
    y=nowy;
    display();
}
int main(int argc, char**argv)
{
    glutInit(&argc ,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("week04");
    glutDisplayFunc(display);
    glutMotionFunc(motion);
    glutMainLoop();
}

我都不知道我專研要做什麼……
⢠⠤⣤⠀⠤⡤⠄⢠⡤⢤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⢸⠲⣏⠀⢀⡇⠀⢸⡗⠚⢀⣤⣶⣾⣿⣷⣶⣤⣄⠀⠀⣀⣤⣤⣴⣦⣤⡀⠀⠀⠀⠀⠀⠀⠀ ⠈⠀⠈⠀⠉⠉⠁⠈⠁⣴⣿⣿⣿⡿⠿⣛⣛⠻⠿⣧⢻⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣫⣵⣾⣿⣿⣿⡿⠷⠦⠔⣶⣶⣶⣶⣶⠶⠶⠶⠤⡀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⢠⣾⣿⣿⣿⣿⣿⠿⠛⢁⣀⣌⣿⣿⣷⣶⣈⠿⣒⣒⣭⣭⣭⣭⣑⣒⠄⠀⠀ ⠀⠀⠀⠀⣠⡎⣾⣿⣿⣿⣿⢫⣡⡥⠶⠿⣛⠛⠋⠳⢶⣶⣾⣜⣫⣭⣷⠖⡁⠀⠐⢶⣯⡆⠀ ⠀⠀⠀⣰⣿⣷⣿⣿⣿⣿⣿⣷⣖⢟⡻⢿⠃⢸⠱⠶⠀⠿⠟⡻⠿⣿⡏⠀⠅⠛⠀⣘⠟⠁⠀ ⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣮⣥⣤⣴⣤⣦⠄⣠⣾⣿⡻⠿⠾⠿⠿⠟⠛⠁⠀⠀⠀ ⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣭⣶⣿⣿⣿⣿⣿⣷⣿⣿⣿⣧⡀⠀⠀⠀⠀ ⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀ ⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢩⡤⠶⠶⠶⠦⠬⣉⣛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⣋⣡⠀⠀⠀ ⠀⠘⣿⣿⣿⣿⣿⣿⣟⢿⣧⣙⠓⢒⣚⡛⠳⠶⠤⢬⣉⣉⣉⣉⣉⣉⣉⣉⣉⣉⡄⠀⠀⠀⠀ ⠀⠀⠈⠻⢿⣿⣿⣿⣿⣶⣽⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣤⣤⣤⣤⣤⣤⡥⠄⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠐⠒⠭⢭⣛⣛⡻⠿⠿⠿⠿⣿⣿⣿⣿⣿⠿⠿⠿⠛⠋⠁.

沒有留言:

張貼留言