2020年3月18日 星期三

陳靜宜穿格子四角褲


1.小葉給的下載網頁下載Data,win32,glut32.dll。
















接著將WIN32解壓縮,把DATA跟glut32.dll拉到解好壓縮的windows就可以使用了


























2.開啟上週教的GLUT






接著加入可以拖曳茶壺的程式碼:


#include <GL/glut.h>
#include <stdio.h>
float teapotX=0,teapotY=0;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
        glTranslatef(teapotX,teapotY,0);
        glutSolidTeapot( 0.3 );

    glPopMatrix();
    glutSwapBuffers();
}
void mouse(int button, int state, int x, int y)
{
    teapotX=(x-150)/150.0;
    teapotY=-(y-150)/150.0;
}
int main(int argc, char**argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("week03");

    glutDisplayFunc(display);
    glutMouseFunc(mouse);
    glutMainLoop();
}























自己動手做圖案!

沒有留言:

張貼留言