1.註冊github.com
1.1認證email,再輸入6碼認證
2.改profile 的照片
3.我們要新增github的專案倉庫
3.1 Repo裡面,New取名2021graphics\
3.2 勾Add README
3.3 勾Add.gitignore 在選C++完成
(等一下我們要把CodeBlocks專案放上去);
4.上傳你的程式
4.1 在2020graphics專案倉庫Add file
4.2 Upload files (檔案.目錄)commit確認
5.在寫GLUT 專案(今天上課要用)
5.1 File -New-Project ,GLUT
5.2 我們的桌面要有2020電腦圖學裡面的freeglut.a改libglut32.a
5.4 把上週的程式開起來
5.5 把上周的程式也上傳到github
6.**畫圓形的方法:
方法1:使用實心的圓
1.把上周的基礎main()和display()複製
2.display()加glutSolidSPhere(半徑,30,30)
<程式碼>
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1,1,0);
glutSolidSphere(0.5,30,30);
glutSwapBuffers();
}
int main (int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("Week03-circle");
glutDisplayFunc(display);
glutMainLoop();
}
7.**扁扁的圓 使用cos () sin()單位圓
<程式碼>
#include <GL/glut.h>
#include <math.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1,0,0);
glBegin(GL_POLYGON);
for (int i=0;i<30;i++){
float a=3.1415926*2/30*i;
glVertex2f(0.5+0.1*cos(a),0.2*sin(a));
}
glEnd();
glutSwapBuffers();
}
int main (int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("Week03-circle");
glutDisplayFunc(display);
glutMainLoop();
}




沒有留言:
張貼留言