2018年3月12日 星期一

week03 fish

week03:

茶壺


色採、點線面複習

#include <GL/glut.h>
void display()
{
    glClearColor(1,1,0, 1);///背景
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);///兩種模式
    glutSolidTeapot(0.3);

    glutSwapBuffers();///教畫畫面BUFFER便會顯示
}

int main(int argc,char ** argv)///進階的main()參數(個數,字串)
{
    glutInit(&argc,argv);///近接參數初始GLUT
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);///開啟兩種模式
    glutCreateWindow("week03 Mouse操作");///盡量不要用中文
    glutDisplayFunc(display);///等一下樓上要準備void display()
    ///glutMouseFunc(mouse);///等一下會準備好MOUSE()功能,按鈕
    ///glutMotionFunc(motion);///等一下會準備好MOTION(),移動
    glutMainLoop();///主要迴圈



跑出程式


跑出程式


跑出程式
2.加入mouse功能加入printf("%d %d %d %d\n",button,state,x,y);


可拖曳茶壺
加入Motion





沒有留言:

張貼留言