2019年3月14日 星期四

六到布行的部落 3

20190307  Week3

1. 主題:點,線,面,顏色

從範例程式當中可以看到點線面顏色的範例



第一個親手寫出的程式碼

#include <GL/glut.h>
float x=0,y=0;
void display()
{
    glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
    glTranslatef((x-150)/150.0,-(y-150)/150.0,0);
    glutSolidTeapot( 0.3 );
    glPopMatrix();
    glutSwapBuffers();
}
void motion(int nowX,int nowY)
{
    x=nowX; y=nowY;
    display();
}
int main(int argc, char**argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
    glutCreateWindow("06160166_Week03!!");
    glutDisplayFunc(display);
    glutMotionFunc(motion);
    glutMainLoop();

}
回家作業


沒有留言:

張貼留言