今日課程內容:
1.按照老方法開啟glut
更改libfreeglut.a名字為libglut32.a等等....
每次都要改這個真的有點煩了....
⣿⣿⣿⣿⠟⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠒⠻⣿⣿⣿⣿⣿⣿ ⣿⡿⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠹⣿⣿⣿ ⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⠁⠨⢻⣿ ⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣰⣾⣾⣿⣷⣤⡀⠄⠄⠄⠄⠄⠄⠄⠈⣿ ⠄⠄⠄⠄⠄⠄⠄⠄⠄⣀⣠⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣦⣄⠄⠄⠄⠄⠄⠄⢸ ⠄⠄⠄⠄⠄⢀⡴⠶⡿⠛⠛⠛⠛⢿⣿⣿⣿⣿⡟⠉⣉⣉⣉⣁⣀⡀⠄⠄⠄⠈ ⠄⠄⠄⠄⠴⠏⣚⣻⣯⣭⣭⣭⣤⣄⡛⠛⠛⠛⣫⣽⣶⣶⣶⣿⣷⣄⠄⠄⠄⢰ ⠄⢀⣰⣇⣀⣾⣿⡿⠿⠟⠛⠙⠻⣿⡇⢸⣿⠧⢹⣿⢁⣀⡠⢉⣹⣿⡀⡆⠄⢸ ⠄⢋⣉⣿⣿⣌⣧⣴⣶⣶⣶⣯⣶⡿⣳⣿⣷⣾⣧⣿⠿⠿⠿⠿⢿⣿⣫⣾⡀⢀ ⠄⢸⣿⣿⣿⣿⣶⣾⣿⣿⣷⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠈ ⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣵⠿⠿⢿⢿⡿⠟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣀ ⣤⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⠆⣀⣠⣼⣤⣄⣺⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠉⠿⠿⠿⠿⢿⣛⣛⡋⠉⠉⢹⣿⣿⣿⣿⣿ ⣘⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣼⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⠿⢿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⠟⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠒⠻⣿⣿⣿⣿⣿⣿ ⣿⡿⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠹⣿⣿⣿ ⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⠁⠨⢻⣿ ⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣰⣾⣾⣿⣷⣤⡀⠄⠄⠄⠄⠄⠄⠄⠈⣿ ⠄⠄⠄⠄⠄⠄⠄⠄⠄⣀⣠⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣦⣄⠄⠄⠄⠄⠄⠄⢸ ⠄⠄⠄⠄⠄⢀⡴⠶⡿⠛⠛⠛⠛⢿⣿⣿⣿⣿⡟⠉⣉⣉⣉⣁⣀⡀⠄⠄⠄⠈ ⠄⠄⠄⠄⠴⠏⣚⣻⣯⣭⣭⣭⣤⣄⡛⠛⠛⠛⣫⣽⣶⣶⣶⣿⣷⣄⠄⠄⠄⢰ ⠄⢀⣰⣇⣀⣾⣿⡿⠿⠟⠛⠙⠻⣿⡇⢸⣿⠧⢹⣿⢁⣀⡠⢉⣹⣿⡀⡆⠄⢸ ⠄⢋⣉⣿⣿⣌⣧⣴⣶⣶⣶⣯⣶⡿⣳⣿⣷⣾⣧⣿⠿⠿⠿⠿⢿⣿⣫⣾⡀⢀ ⠄⢸⣿⣿⣿⣿⣶⣾⣿⣿⣷⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠈ ⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣵⠿⠿⢿⢿⡿⠟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣀ ⣤⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⠆⣀⣠⣼⣤⣄⣺⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠉⠿⠿⠿⠿⢿⣛⣛⡋⠉⠉⢹⣿⣿⣿⣿⣿ ⣘⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣼⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⠿⢿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
2.開啟Transformation
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();
}
我都不知道我專研要做什麼……
⢠⠤⣤⠀⠤⡤⠄⢠⡤⢤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⢸⠲⣏⠀⢀⡇⠀⢸⡗⠚⢀⣤⣶⣾⣿⣷⣶⣤⣄⠀⠀⣀⣤⣤⣴⣦⣤⡀⠀⠀⠀⠀⠀⠀⠀ ⠈⠀⠈⠀⠉⠉⠁⠈⠁⣴⣿⣿⣿⡿⠿⣛⣛⠻⠿⣧⢻⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣫⣵⣾⣿⣿⣿⡿⠷⠦⠔⣶⣶⣶⣶⣶⠶⠶⠶⠤⡀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⢠⣾⣿⣿⣿⣿⣿⠿⠛⢁⣀⣌⣿⣿⣷⣶⣈⠿⣒⣒⣭⣭⣭⣭⣑⣒⠄⠀⠀ ⠀⠀⠀⠀⣠⡎⣾⣿⣿⣿⣿⢫⣡⡥⠶⠿⣛⠛⠋⠳⢶⣶⣾⣜⣫⣭⣷⠖⡁⠀⠐⢶⣯⡆⠀ ⠀⠀⠀⣰⣿⣷⣿⣿⣿⣿⣿⣷⣖⢟⡻⢿⠃⢸⠱⠶⠀⠿⠟⡻⠿⣿⡏⠀⠅⠛⠀⣘⠟⠁⠀ ⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣮⣥⣤⣴⣤⣦⠄⣠⣾⣿⡻⠿⠾⠿⠿⠟⠛⠁⠀⠀⠀ ⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣭⣶⣿⣿⣿⣿⣿⣷⣿⣿⣿⣧⡀⠀⠀⠀⠀ ⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀ ⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢩⡤⠶⠶⠶⠦⠬⣉⣛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⣋⣡⠀⠀⠀ ⠀⠘⣿⣿⣿⣿⣿⣿⣟⢿⣧⣙⠓⢒⣚⡛⠳⠶⠤⢬⣉⣉⣉⣉⣉⣉⣉⣉⣉⣉⡄⠀⠀⠀⠀ ⠀⠀⠈⠻⢿⣿⣿⣿⣿⣶⣽⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣤⣤⣤⣤⣤⣤⡥⠄⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠐⠒⠭⢭⣛⣛⡻⠿⠿⠿⠿⣿⣿⣿⣿⣿⠿⠿⠿⠛⠋⠁.
沒有留言:
張貼留言