2016年5月24日 星期二

W14
(1)使用貝殼專案
程式碼--
#include <stdio.h>
FILE * fout = NULL,*fin = NULL;
int main(int argc,char**argv)
{
    if(fout==NULL)
        fout = fopen("output.txt","wt");
        fprintf(fout,"Hello World\n");
        return 0;
}

作業2
茶壺讀取


.加入檔案
程式碼--
#include <GL/glut.h>
#include <stdio.h>
FILE * fout = NULL,*fin = NULL;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glutSolidTeapot(0.3);
    glutSwapBuffers();
}
void motion(int x, int y)
{
    if(fout==NULL) fout=fopen("motion.txt","w+");
    fprintf(fout, "%d %d\n",x,y);
    printf("%d %d\n",x,y);
}
int main(int argc,char**argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("3D");
    glutDisplayFunc(display);
    glutMotionFunc(motion);
    glutMainLoop();
}
(3).缺少freeglut.dll檔,放置目錄位置。

沒有留言:

張貼留言