2021年3月10日 星期三

week03電腦圖學

 

使用GitHub來紀錄每周程式碼



#include <GL/glut.h>
#include <math.h>///使用數學外掛
static void display(void)
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glBegin(GL_POLYGON);
    glColor3f(1,0,0);
    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("08160226");
    glutDisplayFunc(display);
    glutMainLoop();
}







沒有留言:

張貼留言

距地表面160 Week11

 #include "glm.h" GLMmodel* pmodel = NULL; void drawmodel(void) {     if (!pmodel) { pmodel = glmReadOBJ("data/porsche.obj...