用git指令下載上禮拜的鋼彈專案
用codeblocks的open file開啟
1.改檔名
把剛剛的專案關起來 close Project
目錄:把上裡禮拜的鋼彈專案複製到桌面
再把名字改成week09-1
打開專案裡的資料夾,留cbp檔也改成week09-1
用notepad++打開cbp檔 把裡面所有的week08-3都改成week09-1存檔
再用codeblocks打開
2.畫方塊 茶壺 圓形
用期中考的程式碼+之前11行程式
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslated(-0.5,+0.3,0);
glutSolidTeapot(0.3);
glPopMatrix();
glPushMatrix();
glTranslated(+0.0,0.3,0);
glutSolidCube(0.3);
glPopMatrix();
glPushMatrix();
glTranslated(+0.5,+0.3,0);
glutSolidSphere(0.3,30,30);
glPopMatrix();
glutSwapBuffers();
}
int main(int argc, char*argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week09 Microsoft Visual Studio");
glutDisplayFunc(display);
glutMainLoop();
}
glTranslated(-0.5,+0.3,0);
glutSolidTeapot(0.3);
glPopMatrix();
glPushMatrix();
glTranslated(+0.0,0.3,0);
glutSolidCube(0.3);
glPopMatrix();
glPushMatrix();
glTranslated(+0.5,+0.3,0);
glutSolidSphere(0.3,30,30);
glPopMatrix();
複製貼上
把所有的Solid改成Wire
把y座標改成負的
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslated(-0.5,+0.3,0);
glutSolidTeapot(0.3);
glPopMatrix();
glPushMatrix();
glTranslated(+0.0,0.3,0);
glutSolidCube(0.3);
glPopMatrix();
glPushMatrix();
glTranslated(+0.5,+0.3,0);
glutSolidSphere(0.3,30,30);
glPopMatrix();
glPushMatrix();
glTranslated(-0.5,-0.3,0);
glutWireTeapot(0.3);
glPopMatrix();
glPushMatrix();
glTranslated(+0.0,-0.3,0);
glutWireCube(0.3);
glPopMatrix();
glPushMatrix();
glTranslated(+0.5,-0.3,0);
glutWireSphere(0.3,30,30);
glPopMatrix();
glutSwapBuffers();
}
int main(int argc, char*argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week09 Microsoft Visual Studio");
glutDisplayFunc(display);
glutMainLoop();
}


沒有留言:
張貼留言