2018年3月5日 星期一

week02

1.TODO: jsyeh.org/3dcg10
    
   下載 data, win32, glut32.dll
2.執行Shape.exe


3.將data放入之後

   執行Transformation.exe



4.利用兩個程式 組成新的圖案



#include <GL/glut.h>
void display()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glutSolidTeapot(0.3);
    glutSwapBuffers();
}

int main(int argc, char**argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE);
    glutCreateWindow("02163610_Week02 Good!!!");

    glutDisplayFunc(display);
    glutMainLoop();
}



5.動手打一次程式碼


#include <GL/glut.h>
void display()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glutSolidTeapot(0.3);
    glutSwapBuffers();
}

int main(int argc, char**argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE);
    glutCreateWindow("02163610_Week02 Good!!!");

    glutDisplayFunc(display);
    glutMainLoop();
}

調顏色



#include <GL/glut.h>
void display()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1,1,0);///黃色

    glBegin(GL_POLYGON);

        glColor3f(1.0f, 0.0f, 0.0f);   glVertex2f(0.0f,   1.0f);
        glColor3f(0.0f, 1.0f, 0.0f);   glVertex2f(0.87f,  -0.5f);
        glColor3f(0.0f, 0.0f, 1.0f);   glVertex2f(-0.1f, -0.5f);



    glEnd();
    glutSwapBuffers();
}

int main(int argc, char**argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE);
    glutCreateWindow("02163610_Week02 Good!!!");

    glutDisplayFunc(display);
    glutMainLoop();
}




沒有留言:

張貼留言