今天教github上傳自己的作品
老師也分享了自己對於github看法
後面做的第一個程式
#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("try-t");
glutDisplayFunc(display);
glutMainLoop();
}
因為專案開錯,所以一直運行不起來,可以識別的方法就是注意附檔名應該為.cpp
#include <GL/glut.h>
#include <math.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(0.5,0,1);
//glutSolidSphere(0.5,30,30);
glBegin(GL_POLYGON);
for (float a=0;a<3.14159*2;a+=0.1)
{
glVertex2f(cos(a)/2,sin(a));
}
glEnd();
glutSwapBuffers();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("try-t");
glutDisplayFunc(display);
glutMainLoop();
}
沒有留言:
張貼留言