2020年3月17日 星期二

Week 03 以點畫圖

上周茶壺複習



#include <GL/glut.h>
#include <stdio.h>
void display()
{

    glutSolidTeapot( 0.3 );  ///實心茶壺
    glutSwapBuffers(); ///交換兩倍buffer s
}
void mouse(int button,int state,int x,int y)
{
    printf("%d %d %d %d\n",button,state,x,y);
}
///左0中1右2, 下0上1,x y座標

int main(int argc, char**argv) ///高手等級的main()
{
    glutInit(&argc,argv);///main的參數,於近來
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    ///啟動3D的顯示能力,兩倍顯示buffer,有3D深度值
    glutCreateWindow("week03 YES!!!");
    ///建立3D窗子
    glutDisplayFunc(display);
    ///等一下怎麼畫
    glutMouseFunc(mouse);///mouse函式
    glutMainLoop();
    ///主要迴圈卡在這裡,不會結束
}
#include <GL/glut.h>
#include <stdio.h>
float teapotx=0,teapoty=0;///-1~+1的座標
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);///清背景
    glPushMatrix();///備份矩陣
        glTranslated(teapotx,teapoty,0);///移動
        glutSolidTeapot( 0.3 );  ///實心茶壺
    glPopMatrix();///備份矩陣
    glutSwapBuffers(); ///交換兩倍buffer s
}
void mouse(int button,int state,int x,int y)
{
    ///printf("%d %d %d %d\n",button,state,x,y);
    printf("%f %f\n",(x-150)/150.0,(y-150)/150.0);
    teapotx=(x-150)/150.0;
    teapoty=  -(y-150)/150.0;  ///y在小畫家 裡是由下為正
}
///左0中1右2, 下0上1,x y座標

int main(int argc, char**argv) ///高手等級的main()
{
    glutInit(&argc,argv);///main的參數,於近來
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    ///啟動3D的顯示能力,兩倍顯示buffer,有3D深度值
    glutCreateWindow("week03 YES!!!");
    ///建立3D窗子
    glutDisplayFunc(display);
    ///等一下怎麼畫
    glutMouseFunc(mouse);///mouse函式
    glutMainLoop();
    ///主要迴圈卡在這裡,不會結束
}
概念圖
程式碼

#include <GL/glut.h>
#include <stdio.h>
#include <math.h>

void display()

{
    glClearColor((255/255.0),(214/255.0),(160/255.0),0.1);///
    glLineWidth(5);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glBegin(GL_LINES);///mouse
        glColor3ub(0,0,0);
        glVertex2f((185-150)/150.0, - (227-150)/150.0);
        glVertex2f((195-150)/150.0, - (220-150)/150.0);
        glVertex2f((195-150)/150.0, - (220-150)/150.0);
        glVertex2f((209-150)/150.0, - (215-150)/150.0);
        glVertex2f((209-150)/150.0, - (215-150)/150.0);
        glVertex2f((227-150)/150.0, - (212-150)/150.0);
        glVertex2f((227-150)/150.0, - (212-150)/150.0);
        glVertex2f((246-150)/150.0, - (212-150)/150.0);
        glVertex2f((246-150)/150.0, - (212-150)/150.0);
        glVertex2f((259-150)/150.0, - (223-150)/150.0);
        glVertex2f((259-150)/150.0, - (223-150)/150.0);
        glVertex2f((269-150)/150.0, - (237-150)/150.0);
        glVertex2f((269-150)/150.0, - (237-150)/150.0);
        glVertex2f((273-150)/150.0, - (257-150)/150.0);
        glVertex2f((273-150)/150.0, - (257-150)/150.0);
        glVertex2f((272-150)/150.0, - (278-150)/150.0);
    glEnd();
     glBegin(GL_POLYGON);
    glColor3ub(0,0,0);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.1*cos(angle)+0.83,-0.12*sin(angle)-0.9);
    }
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,255,255);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.08*cos(angle)+0.83,-0.1*sin(angle)-0.9);
    }
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(0,0,0);
        glVertex2f((260-150)/150.0, - (285-150)/150.0);
        glVertex2f((287-150)/150.0, - (285-150)/150.0);

    glEnd();
    glBegin(GL_LINES);
        glColor3ub(0,0,0);
        glVertex2f((274-150)/150.0, - (267-150)/150.0);
        glVertex2f((273-150)/150.0, - (282-150)/150.0);

    glEnd();///mouse
    glBegin(GL_POLYGON);///evil
    glColor3ub(0,0,0);
        glVertex2f((232-150)/150.0, - (20-150)/150.0);
        glVertex2f((254-150)/150.0, - (32-150)/150.0);
        glVertex2f((263-150)/150.0, - (1-150)/150.0);

    glEnd();
     glBegin(GL_POLYGON);
    glColor3ub(0,0,0);
        glVertex2f((172-150)/150.0, - (29-150)/150.0);
        glVertex2f((191-150)/150.0, - (22-150)/150.0);
        glVertex2f((165-150)/150.0, - (0-150)/150.0);

    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,0,0);
        glVertex2f((261-150)/150.0, - (4-150)/150.0);
        glVertex2f((233-150)/150.0, - (22-150)/150.0);
        glVertex2f((251-150)/150.0, - (34-150)/150.0);
    glEnd();
     glBegin(GL_POLYGON);
    glColor3ub(255,0,0);
        glVertex2f((173-150)/150.0, - (29-150)/150.0);
        glVertex2f((200-150)/150.0, - (32-150)/150.0);
        glVertex2f((166-150)/150.0, - (2-150)/150.0);
    glEnd();

    ///evil
    glBegin(GL_POLYGON);///face
    glColor3ub(0,0,0);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.42*cos(angle)+0.4,-0.38*sin(angle)+0.55);
    }
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,174,200);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.40*cos(angle)+0.4,-0.36*sin(angle)+0.55);
    }
    glEnd();

///face

    glBegin(GL_LINES);///eyes
        glColor3ub(0,0,0);
            glVertex2f((218-150)/150.0, - (32-150)/150.0);
            glVertex2f((242-150)/150.0, - (47-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(0,0,0);
            glVertex2f((193-150)/150.0, - (32-150)/150.0);
            glVertex2f((172-150)/150.0, - (47-150)/150.0);

    glEnd();///eyes


    glBegin(GL_POLYGON);///computer
    glColor3ub(0,0,0);
    glVertex2f((39-150)/150.0, - (60-150)/150.0);
    glVertex2f((231-150)/150.0, - (60-150)/150.0);
    glVertex2f((231-150)/150.0, - (200-150)/150.0);
    glVertex2f((39-150)/150.0, - (200-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
        glColor3ub(58,58,58);
        glVertex2f((50-150)/150.0, - (70-150)/150.0);
        glVertex2f((220-150)/150.0, - (70-150)/150.0);
        glVertex2f((220-150)/150.0, - (190-150)/150.0);
        glVertex2f((50-150)/150.0, - (190-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(0,0,0);
    glVertex2f((120-150)/150.0, - (198-150)/150.0);
        glVertex2f((141-150)/150.0, - (198-150)/150.0);
        glVertex2f((141-150)/150.0, - (220-150)/150.0);
        glVertex2f((120-150)/150.0, - (220-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
        glVertex2f((66-150)/150.0, - (219-150)/150.0);
        glVertex2f((66-150)/150.0, - (240-150)/150.0);
        glVertex2f((190-150)/150.0, - (240-150)/150.0);
        glVertex2f((190-150)/150.0, - (219-150)/150.0);
    glEnd();
    glBegin(GL_LINES);///word
        glColor3ub(255,255,255);
        glVertex2f((87-150)/150.0, - (81-150)/150.0);
        glVertex2f((60-150)/150.0, - (137-150)/150.0);

    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((82-150)/150.0, - (88-150)/150.0);
        glVertex2f((103-150)/150.0, - (115-150)/150.0);

    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((73-150)/150.0, - (110-150)/150.0);
        glVertex2f((95-150)/150.0, - (110-150)/150.0);

    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((75-150)/150.0, - (117-150)/150.0);
        glVertex2f((93-150)/150.0, - (117-150)/150.0);
        glEnd();
        glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((93-150)/150.0, - (114-150)/150.0);
        glVertex2f((94-150)/150.0, - (130-150)/150.0);
        glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((74-150)/150.0, - (122-150)/150.0);
        glVertex2f((93-150)/150.0, - (124-150)/150.0);
    glEnd();
     glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((75-150)/150.0, - (131-150)/150.0);
        glVertex2f((93-150)/150.0, - (131-150)/150.0);
    glEnd();
     glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((73-150)/150.0, - (114-150)/150.0);
        glVertex2f((73-150)/150.0, - (162-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((70-150)/150.0, - (158-150)/150.0);
        glVertex2f((88-150)/150.0, - (152-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((78-150)/150.0, - (139-150)/150.0);
        glVertex2f((103-150)/150.0, - (160-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((109-150)/150.0, - (114-150)/150.0);
        glVertex2f((193-150)/150.0, - (118-150)/150.0);

    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((142-150)/150.0, - (76-150)/150.0);
        glVertex2f((114-150)/150.0, - (93-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((127-150)/150.0, - (83-150)/150.0);
        glVertex2f((127-150)/150.0, - (160-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((110-150)/150.0, - (145-150)/150.0);
        glVertex2f((128-150)/150.0, - (160-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((140-150)/150.0, - (125-150)/150.0);
        glVertex2f((111-150)/150.0, - (133-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((154-150)/150.0, - (76-150)/150.0);
        glVertex2f((166-150)/150.0, - (162-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((164-150)/150.0, - (160-150)/150.0);
        glVertex2f((178-150)/150.0, - (149-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((177-150)/150.0, - (128-150)/150.0);
        glVertex2f((149-150)/150.0, - (145-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
        glColor3ub(255,255,255);
        glVertex2f((166-150)/150.0, - (80-150)/150.0);
        glVertex2f((182-150)/150.0, - (104-150)/150.0);
    glEnd();
///word
///water
glBegin(GL_POLYGON);
    glColor3ub(0,0,0);
        glVertex2f((232-150)/150.0, - (58-150)/150.0);
        glVertex2f((231-150)/150.0, - (94-150)/150.0);
        glVertex2f((227-150)/150.0, - (95-150)/150.0);
        glVertex2f((223-150)/150.0, - (95-150)/150.0);
        glVertex2f((218-150)/150.0, - (90-150)/150.0);
        glVertex2f((216-150)/150.0, - (90-150)/150.0);
        glVertex2f((210-150)/150.0, - (95-150)/150.0);
        glVertex2f((203-150)/150.0, - (94-150)/150.0);
        glVertex2f((196-150)/150.0, - (92-150)/150.0);
        glVertex2f((191-150)/150.0, - (90-150)/150.0);
        glVertex2f((189-150)/150.0, - (89-150)/150.0);
        glVertex2f((183-150)/150.0, - (89-150)/150.0);
        glVertex2f((178-150)/150.0, - (85-150)/150.0);
        glVertex2f((176-150)/150.0, - (82-150)/150.0);
        glVertex2f((170-150)/150.0, - (82-150)/150.0);
        glVertex2f((163-150)/150.0, - (82-150)/150.0);
        glVertex2f((155-150)/150.0, - (81-150)/150.0);
        glVertex2f((151-150)/150.0, - (74-150)/150.0);
        glVertex2f((149-150)/150.0, - (67-150)/150.0);
        glVertex2f((149-150)/150.0, - (56-150)/150.0);
        glVertex2f((232-150)/150.0, - (57-150)/150.0);

    glEnd();
   glBegin(GL_POLYGON);
    glColor3ub(140,255,251);
        glVertex2f((151-150)/150.0, - (56-150)/150.0);
        glVertex2f((153-150)/150.0, - (71-150)/150.0);
        glVertex2f((156-150)/150.0, - (79-150)/150.0);
        glVertex2f((160-150)/150.0, - (81-150)/150.0);
        glVertex2f((165-150)/150.0, - (79-150)/150.0);
        glVertex2f((170-150)/150.0, - (77-150)/150.0);
        glVertex2f((170-150)/150.0, - (72-150)/150.0);
        glVertex2f((174-150)/150.0, - (71-150)/150.0);
        glVertex2f((177-150)/150.0, - (72-150)/150.0);
        glVertex2f((179-150)/150.0, - (76-150)/150.0);
        glVertex2f((181-150)/150.0, - (83-150)/150.0);
        glVertex2f((183-150)/150.0, - (85-150)/150.0);
        glVertex2f((186-150)/150.0, - (86-150)/150.0);
        glVertex2f((189-150)/150.0, - (84-150)/150.0);
        glVertex2f((191-150)/150.0, - (78-150)/150.0);
        glVertex2f((191-150)/150.0, - (73-150)/150.0);
        glVertex2f((193-150)/150.0, - (72-150)/150.0);
        glVertex2f((197-150)/150.0, - (76-150)/150.0);
        glVertex2f((199-150)/150.0, - (85-150)/150.0);
        glVertex2f((200-150)/150.0, - (89-150)/150.0);
        glVertex2f((202-150)/150.0, - (92-150)/150.0);
        glVertex2f((207-150)/150.0, - (92-150)/150.0);
        glVertex2f((211-150)/150.0, - (91-150)/150.0);
        glVertex2f((212-150)/150.0, - (90-150)/150.0);
        glVertex2f((216-150)/150.0, - (85-150)/150.0);
        glVertex2f((218-150)/150.0, - (84-150)/150.0);
        glVertex2f((223-150)/150.0, - (87-150)/150.0);
        glVertex2f((224-150)/150.0, - (92-150)/150.0);
        glVertex2f((227-150)/150.0, - (95-150)/150.0);
        glVertex2f((230-150)/150.0, - (93-150)/150.0);
        glVertex2f((231-150)/150.0, - (58-150)/150.0);
    glEnd();///water
    ///mouth
    glBegin(GL_POLYGON);
    glColor3ub(0,0,0);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.068*cos(angle)+0.50,-0.07*sin(angle)+0.61);
    }
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(0,0,0);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.068*cos(angle)+0.36,-0.07*sin(angle)+0.61);
    }
    glEnd();

    glBegin(GL_POLYGON);
    glColor3ub(0,0,0);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.068*cos(angle)+0.23,-0.07*sin(angle)+0.61);
    }
    glEnd();
        glBegin(GL_POLYGON);
    glColor3ub(0,0,0);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.068*cos(angle)+0.08,-0.07*sin(angle)+0.61);
    }
    glEnd();

    glBegin(GL_POLYGON);
    glColor3ub(255,174,200);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.065*cos(angle)+0.50,-0.06*sin(angle)+0.61);
    }
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,174,200);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.065*cos(angle)+0.36,-0.06*sin(angle)+0.61);
    }
    glEnd();

    glBegin(GL_POLYGON);
    glColor3ub(255,174,200);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.065*cos(angle)+0.23,-0.06*sin(angle)+0.61);
    }
    glEnd();
        glBegin(GL_POLYGON);
    glColor3ub(255,174,200);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.065*cos(angle)+0.08,-0.06*sin(angle)+0.61);
    }
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,174,200);
        glVertex2f((227-150)/150.0, - (54-150)/150.0);
        glVertex2f((229-150)/150.0, - (45-150)/150.0);
        glVertex2f((181-150)/150.0, - (46-150)/150.0);
        glVertex2f((172-150)/150.0, - (50-150)/150.0);
        glVertex2f((167-150)/150.0, - (46-150)/150.0);
        glVertex2f((154-150)/150.0, - (50-150)/150.0);
        glVertex2f((152-150)/150.0, - (59-150)/150.0);
        glVertex2f((227-150)/150.0, - (59-150)/150.0);

    glEnd();
     ///mouth

    glBegin(GL_POLYGON);///tail
    glColor3ub(0,0,0);
        glVertex2f((251-150)/150.0, - (155-150)/150.0);
        glVertex2f((252-150)/150.0, - (159-150)/150.0);
        glVertex2f((252-150)/150.0, - (164-150)/150.0);
        glVertex2f((252-150)/150.0, - (168-150)/150.0);
        glVertex2f((245-150)/150.0, - (184-150)/150.0);
        glVertex2f((249-150)/150.0, - (155-150)/150.0);
        glVertex2f((250-150)/150.0, - (159-150)/150.0);
        glVertex2f((250-150)/150.0, - (164-150)/150.0);
        glVertex2f((250-150)/150.0, - (168-150)/150.0);
        glVertex2f((243-150)/150.0, - (184-150)/150.0);
    glEnd();
     glBegin(GL_POLYGON);
        glColor3ub(255,0,0);
        glVertex2f((237-150)/150.0, - (175-150)/150.0);
        glVertex2f((255-150)/150.0, - (175-150)/150.0);
        glVertex2f((242-150)/150.0, - (189-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);///wing
    glColor3ub(0,0,0);
        glVertex2f((244-150)/150.0, - (111-150)/150.0);
        glVertex2f((259-150)/150.0, - (123-150)/150.0);
        glVertex2f((262-150)/150.0, - (123-150)/150.0);
        glVertex2f((267-150)/150.0, - (123-150)/150.0);
        glVertex2f((268-150)/150.0, - (118-150)/150.0);
        glVertex2f((269-150)/150.0, - (116-150)/150.0);
        glVertex2f((273-150)/150.0, - (117-150)/150.0);
        glVertex2f((280-150)/150.0, - (121-150)/150.0);
        glVertex2f((285-150)/150.0, - (121-150)/150.0);
        glVertex2f((284-150)/150.0, - (81-150)/150.0);
        glVertex2f((244-150)/150.0, - (104-150)/150.0);
        glVertex2f((240-150)/150.0, - (109-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(184,61,186);
            glVertex2f((247-150)/150.0, - (109-150)/150.0);
            glVertex2f((251-150)/150.0, - (115-150)/150.0);
            glVertex2f((255-150)/150.0, - (117-150)/150.0);
            glVertex2f((256-150)/150.0, - (119-150)/150.0);
            glVertex2f((261-150)/150.0, - (120-150)/150.0);
            glVertex2f((265-150)/150.0, - (120-150)/150.0);
            glVertex2f((268-150)/150.0, - (115-150)/150.0);
            glVertex2f((268-150)/150.0, - (113-150)/150.0);
            glVertex2f((268-150)/150.0, - (108-150)/150.0);
            glVertex2f((267-150)/150.0, - (108-150)/150.0);
            glVertex2f((269-150)/150.0, - (107-150)/150.0);
            glVertex2f((271-150)/150.0, - (107-150)/150.0);
            glVertex2f((273-150)/150.0, - (109-150)/150.0);
            glVertex2f((275-150)/150.0, - (112-150)/150.0);
            glVertex2f((280-150)/150.0, - (114-150)/150.0);
            glVertex2f((282-150)/150.0, - (117-150)/150.0);
            glVertex2f((282-150)/150.0, - (117-150)/150.0);
            glVertex2f((281-150)/150.0, - (89-150)/150.0);
            glVertex2f((247-150)/150.0, - (107-150)/150.0);
    glEnd();///wing
    glBegin(GL_POLYGON);///body
    glColor3ub(0,0,0);

        glVertex2f((246-150)/150.0, - (98-150)/150.0);
        glVertex2f((255-150)/150.0, - (118-150)/150.0);
        glVertex2f((258-150)/150.0, - (138-150)/150.0);
        glVertex2f((256-150)/150.0, - (159-150)/150.0);
        glVertex2f((218-150)/150.0, - (167-150)/150.0);
        glVertex2f((210-150)/150.0, - (167-150)/150.0);
        glVertex2f((207-150)/150.0, - (153-150)/150.0);
        glVertex2f((208-150)/150.0, - (147-150)/150.0);
        glVertex2f((217-150)/150.0, - (136-150)/150.0);
        glVertex2f((218-150)/150.0, - (132-150)/150.0);
        glVertex2f((217-150)/150.0, - (131-150)/150.0);
        glVertex2f((211-150)/150.0, - (125-150)/150.0);
        glVertex2f((210-150)/150.0, - (116-150)/150.0);
        glVertex2f((211-150)/150.0, - (112-150)/150.0);
        glVertex2f((246-150)/150.0, - (100-150)/150.0);

    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(0,0,255);
        glVertex2f((246-150)/150.0, - (105-150)/150.0);
        glVertex2f((248-150)/150.0, - (114-150)/150.0);
        glVertex2f((252-150)/150.0, - (122-150)/150.0);
        glVertex2f((252-150)/150.0, - (132-150)/150.0);
        glVertex2f((254-150)/150.0, - (141-150)/150.0);
        glVertex2f((254-150)/150.0, - (151-150)/150.0);
        glVertex2f((253-150)/150.0, - (155-150)/150.0);
        glVertex2f((247-150)/150.0, - (158-150)/150.0);
        glVertex2f((242-150)/150.0, - (158-150)/150.0);
        glVertex2f((237-150)/150.0, - (160-150)/150.0);
        glVertex2f((231-150)/150.0, - (161-150)/150.0);
        glVertex2f((225-150)/150.0, - (162-150)/150.0);
        glVertex2f((222-150)/150.0, - (162-150)/150.0);
        glVertex2f((216-150)/150.0, - (163-150)/150.0);
        glVertex2f((212-150)/150.0, - (157-150)/150.0);
        glVertex2f((212-150)/150.0, - (152-150)/150.0);
        glVertex2f((214-150)/150.0, - (151-150)/150.0);
        glVertex2f((216-150)/150.0, - (150-150)/150.0);
        glVertex2f((218-150)/150.0, - (148-150)/150.0);
        glVertex2f((220-150)/150.0, - (147-150)/150.0);
        glVertex2f((221-150)/150.0, - (145-150)/150.0);
        glVertex2f((222-150)/150.0, - (142-150)/150.0);
        glVertex2f((222-150)/150.0, - (140-150)/150.0);
        glVertex2f((222-150)/150.0, - (136-150)/150.0);
        glVertex2f((222-150)/150.0, - (132-150)/150.0);
        glVertex2f((221-150)/150.0, - (129-150)/150.0);
        glVertex2f((219-150)/150.0, - (128-150)/150.0);
        glVertex2f((218-150)/150.0, - (127-150)/150.0);
        glVertex2f((215-150)/150.0, - (125-150)/150.0);
        glVertex2f((215-150)/150.0, - (122-150)/150.0);
        glVertex2f((215-150)/150.0, - (119-150)/150.0);
        glVertex2f((215-150)/150.0, - (116-150)/150.0);
        glVertex2f((219-150)/150.0, - (114-150)/150.0);
        glVertex2f((221-150)/150.0, - (114-150)/150.0);
        glVertex2f((223-150)/150.0, - (113-150)/150.0);
        glVertex2f((228-150)/150.0, - (113-150)/150.0);
        glVertex2f((233-150)/150.0, - (110-150)/150.0);
        glVertex2f((236-150)/150.0, - (109-150)/150.0);
        glVertex2f((240-150)/150.0, - (107-150)/150.0);
        glVertex2f((244-150)/150.0, - (106-150)/150.0);
        glVertex2f((246-150)/150.0, - (106-150)/150.0);
    glEnd();///body
    glBegin(GL_POLYGON);///keyboard
    glColor3ub(0,0,0);
        glVertex2f((18-150)/150.0, - (251-150)/150.0);
        glVertex2f((245-150)/150.0, - (251-150)/150.0);
        glVertex2f((245-150)/150.0, - (300-150)/150.0);
        glVertex2f((18-150)/150.0, - (300-150)/150.0);
 glEnd();
 glBegin(GL_POLYGON);
    glColor3ub(255,255,255);
         glVertex2f((22-150)/150.0, - (254-150)/150.0);
        glVertex2f((22-150)/150.0, - (258-150)/150.0);
        glVertex2f((26-150)/150.0, - (258-150)/150.0);
        glVertex2f((26-150)/150.0, - (254-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,255,255);
        glVertex2f((29-150)/150.0, - (254-150)/150.0);
        glVertex2f((175-150)/150.0, - (254-150)/150.0);
        glVertex2f((175-150)/150.0, - (258-150)/150.0);
        glVertex2f((29-150)/150.0, - (258-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,255,255);
        glVertex2f((215-150)/150.0, - (256-150)/150.0);
        glVertex2f((236-150)/150.0, - (256-150)/150.0);
        glVertex2f((236-150)/150.0, - (300-150)/150.0);
        glVertex2f((215-150)/150.0, - (300-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,255,255);
        glVertex2f((178-150)/150.0, - (254-150)/150.0);
        glVertex2f((210-150)/150.0, - (254-150)/150.0);
        glVertex2f((210-150)/150.0, - (275-150)/150.0);
        glVertex2f((178-150)/150.0, - (275-150)/150.0);

    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,255,255);
        glVertex2f((181-150)/150.0, - (294-150)/150.0);
        glVertex2f((206-150)/150.0, - (294-150)/150.0);
        glVertex2f((206-150)/150.0, - (288-150)/150.0);
        glVertex2f((200-150)/150.0, - (288-150)/150.0);
        glVertex2f((200-150)/150.0, - (280-150)/150.0);
        glVertex2f((190-150)/150.0, - (280-150)/150.0);
        glVertex2f((190-150)/150.0, - (288-150)/150.0);
        glVertex2f((181-150)/150.0, - (288-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
        glColor3ub(255,255,255);
        glVertex2f((22-150)/150.0, - (265-150)/150.0);
        glVertex2f((171-150)/150.0, - (265-150)/150.0);
        glVertex2f((171-150)/150.0, - (300-150)/150.0);
        glVertex2f((22-150)/150.0, - (300-150)/150.0);
    glEnd();
    ///line
    glLineWidth(3);
    glBegin(GL_LINES);
    glColor3ub(0,0,0);
        glVertex2f((247-150)/150.0, - (11-150)/150.0);
        glVertex2f((258-150)/150.0, - (17-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
    glColor3ub(0,0,0);
        glVertex2f((255-150)/150.0, - (6-150)/150.0);
        glVertex2f((260-150)/150.0, - (8-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
    glColor3ub(0,0,0);
        glVertex2f((243-150)/150.0, - (15-150)/150.0);
        glVertex2f((255-150)/150.0, - (22-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
    glColor3ub(0,0,0);
        glVertex2f((167-150)/150.0, - (8-150)/150.0);
        glVertex2f((172-150)/150.0, - (7-150)/150.0);
    glEnd();
    glBegin(GL_LINES);
    glColor3ub(0,0,0);
        glVertex2f((169-150)/150.0, - (16-150)/150.0);
        glVertex2f((179-150)/150.0, - (13-150)/150.0);
    glEnd();
glutSwapBuffers();
}

void mouse(int button, int state, int x, int y)
{
    if(state==GLUT_DOWN)
    {
    printf("glVertex2f((%d-150)/150.0, - (%d-150)/150.0);\n",x,y);
    }
}

int main(int argc, char**argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("Week03");

    glutDisplayFunc(display);
    glutMouseFunc(mouse);
    glutMainLoop();
}
程式碼
#include <GL/glut.h>
#include <stdio.h>
#include <math.h>

void display()

{
    glClearColor((211/255.0),(169/255.0),(28/255.0),0.1);///
    glLineWidth(10);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glBegin(GL_POLYGON);
        glColor3ub(243,240,240);///box
            glVertex2f((0-150)/150.0, - (0-150)/150.0);
            glVertex2f((300-150)/150.0, - (0-150)/150.0);
            glVertex2f((300-150)/150.0, - (150-150)/150.0);
            glVertex2f((0-150)/150.0, - (150-150)/150.0);

        glEnd();
    glBegin(GL_LINES);
    glColor3ub(255,255,255);
            glVertex2f((30-150)/150.0, - (0-150)/150.0);
            glVertex2f((30-150)/150.0, - (150-150)/150.0);
            glVertex2f((60-150)/150.0, - (0-150)/150.0);
            glVertex2f((60-150)/150.0, - (150-150)/150.0);
            glVertex2f((90-150)/150.0, - (0-150)/150.0);
            glVertex2f((90-150)/150.0, - (150-150)/150.0);
            glVertex2f((120-150)/150.0, - (0-150)/150.0);
            glVertex2f((120-150)/150.0, - (150-150)/150.0);
            glVertex2f((150-150)/150.0, - (0-150)/150.0);
            glVertex2f((150-150)/150.0, - (150-150)/150.0);
            glVertex2f((180-150)/150.0, - (0-150)/150.0);
            glVertex2f((180-150)/150.0, - (143-150)/150.0);
            glVertex2f((210-150)/150.0, - (0-150)/150.0);
            glVertex2f((210-150)/150.0, - (150-150)/150.0);
            glVertex2f((240-150)/150.0, - (0-150)/150.0);
            glVertex2f((240-150)/150.0, - (150-150)/150.0);
            glVertex2f((270-150)/150.0, - (0-150)/150.0);
            glVertex2f((270-150)/150.0, - (150-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,136,207);
            glVertex2f((0-150)/150.0, - (110-150)/150.0);
           glVertex2f((300-150)/150.0, - (110-150)/150.0);
            glVertex2f((300-150)/150.0, - (150-150)/150.0);
            glVertex2f((0-150)/150.0, - (150-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(255,83,186);
            glVertex2f((0-150)/150.0, - (110-150)/150.0);
           glVertex2f((300-150)/150.0, - (110-150)/150.0);
            glVertex2f((300-150)/150.0, - (100-150)/150.0);
            glVertex2f((0-150)/150.0, - (100-150)/150.0);
    glEnd();
        glBegin(GL_POLYGON);
    glColor3ub(249,110,114);///bowl
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
            {
            glVertex2f(0.4*cos(angle)+0.6,-0.15*sin(angle)+0.15);
            }
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(249,110,114);///bowl
            glVertex2f((224-150)/150.0, - (172-150)/150.0);
            glVertex2f((235-150)/150.0, - (172-150)/150.0);
            glVertex2f((244-150)/150.0, - (172-150)/150.0);
            glVertex2f((255-150)/150.0, - (172-150)/150.0);
            glVertex2f((270-150)/150.0, - (172-150)/150.0);
            glVertex2f((279-150)/150.0, - (171-150)/150.0);
            glVertex2f((291-150)/150.0, - (167-150)/150.0);
            glVertex2f((300-150)/150.0, - (164-150)/150.0);
            glVertex2f((300-150)/150.0, - (131-150)/150.0);
            glVertex2f((297-150)/150.0, - (129-150)/150.0);
            glVertex2f((274-150)/150.0, - (136-150)/150.0);
            glVertex2f((255-150)/150.0, - (138-150)/150.0);
            glVertex2f((222-150)/150.0, - (143-150)/150.0);
        glEnd();
           glBegin(GL_POLYGON);
    glColor3ub(157,62,65);///bowl
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
            {
            glVertex2f(0.35*cos(angle)+0.6,-0.1*sin(angle)+0.15);
            }
    glEnd();
    glBegin(GL_POLYGON);///tail
    glColor3ub(238,233,233);
        glVertex2f((228-150)/150.0, - (253-150)/150.0);
        glVertex2f((244-150)/150.0, - (243-150)/150.0);
        glVertex2f((249-150)/150.0, - (237-150)/150.0);
        glVertex2f((256-150)/150.0, - (234-150)/150.0);
        glVertex2f((256-150)/150.0, - (230-150)/150.0);
        glVertex2f((251-150)/150.0, - (230-150)/150.0);
        glVertex2f((246-150)/150.0, - (231-150)/150.0);
        glVertex2f((236-150)/150.0, - (233-150)/150.0);
    glEnd();
        glBegin(GL_POLYGON);
    glColor3ub(255,174,200);///ear
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
            {
            glVertex2f(0.1*cos(angle)-0.46,-0.1*sin(angle)+0.69);
            }
    glEnd();
        glBegin(GL_POLYGON);
         glColor3ub(186,186,186);///ear
            glVertex2f((85-150)/150.0, - (51-150)/150.0);
            glVertex2f((79-150)/150.0, - (46-150)/150.0);
            glVertex2f((71-150)/150.0, - (44-150)/150.0);
            glVertex2f((66-150)/150.0, - (44-150)/150.0);
            glVertex2f((69-150)/150.0, - (37-150)/150.0);
            glVertex2f((74-150)/150.0, - (34-150)/150.0);
            glVertex2f((82-150)/150.0, - (31-150)/150.0);
            glVertex2f((92-150)/150.0, - (34-150)/150.0);
            glVertex2f((99-150)/150.0, - (42-150)/150.0);
            glVertex2f((102-150)/150.0, - (51-150)/150.0);
            glVertex2f((99-150)/150.0, - (57-150)/150.0);
        glEnd();
        glBegin(GL_POLYGON);///leftfoot
        glColor3ub(248,247,247);
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
                {
                    glVertex2f(0.08*cos(angle)-0.8,-0.13*sin(angle)-0.52);

                }
        glEnd();
        glBegin(GL_POLYGON);
        glColor3ub(238,233,233);///屁股
           glVertex2f((119-150)/150.0, - (209-150)/150.0);
            glVertex2f((111-150)/150.0, - (208-150)/150.0);
            glVertex2f((105-150)/150.0, - (204-150)/150.0);
            glVertex2f((94-150)/150.0, - (200-150)/150.0);
            glVertex2f((90-150)/150.0, - (198-150)/150.0);
            glVertex2f((77-150)/150.0, - (195-150)/150.0);
            glVertex2f((72-150)/150.0, - (193-150)/150.0);
            glVertex2f((59-150)/150.0, - (193-150)/150.0);
            glVertex2f((48-150)/150.0, - (197-150)/150.0);
            glVertex2f((42-150)/150.0, - (203-150)/150.0);
            glVertex2f((39-150)/150.0, - (213-150)/150.0);
            glVertex2f((37-150)/150.0, - (218-150)/150.0);
            glVertex2f((35-150)/150.0, - (230-150)/150.0);
            glVertex2f((32-150)/150.0, - (241-150)/150.0);
            glVertex2f((31-150)/150.0, - (253-150)/150.0);
            glVertex2f((36-150)/150.0, - (260-150)/150.0);
            glVertex2f((39-150)/150.0, - (264-150)/150.0);
            glVertex2f((46-150)/150.0, - (272-150)/150.0);
            glVertex2f((53-150)/150.0, - (278-150)/150.0);
            glVertex2f((60-150)/150.0, - (282-150)/150.0);
            glVertex2f((64-150)/150.0, - (284-150)/150.0);
            glVertex2f((73-150)/150.0, - (285-150)/150.0);
            glVertex2f((80-150)/150.0, - (285-150)/150.0);
            glVertex2f((85-150)/150.0, - (284-150)/150.0);
            glVertex2f((88-150)/150.0, - (282-150)/150.0);
            glVertex2f((92-150)/150.0, - (281-150)/150.0);
            glVertex2f((95-150)/150.0, - (280-150)/150.0);
            glVertex2f((100-150)/150.0, - (280-150)/150.0);
            glVertex2f((108-150)/150.0, - (278-150)/150.0);
            glVertex2f((112-150)/150.0, - (278-150)/150.0);
            glVertex2f((118-150)/150.0, - (280-150)/150.0);
            glVertex2f((122-150)/150.0, - (280-150)/150.0);
            glVertex2f((129-150)/150.0, - (283-150)/150.0);
            glVertex2f((137-150)/150.0, - (285-150)/150.0);
            glVertex2f((142-150)/150.0, - (286-150)/150.0);
            glVertex2f((149-150)/150.0, - (287-150)/150.0);
            glVertex2f((154-150)/150.0, - (287-150)/150.0);
            glVertex2f((158-150)/150.0, - (288-150)/150.0);
            glVertex2f((164-150)/150.0, - (288-150)/150.0);
            glVertex2f((170-150)/150.0, - (288-150)/150.0);
            glVertex2f((177-150)/150.0, - (285-150)/150.0);
            glVertex2f((183-150)/150.0, - (286-150)/150.0);
            glVertex2f((194-150)/150.0, - (283-150)/150.0);
            glVertex2f((197-150)/150.0, - (281-150)/150.0);
            glVertex2f((208-150)/150.0, - (276-150)/150.0);
            glVertex2f((211-150)/150.0, - (274-150)/150.0);
            glVertex2f((217-150)/150.0, - (272-150)/150.0);
            glVertex2f((220-150)/150.0, - (268-150)/150.0);
            glVertex2f((220-150)/150.0, - (266-150)/150.0);
            glVertex2f((223-150)/150.0, - (261-150)/150.0);
            glVertex2f((224-150)/150.0, - (257-150)/150.0);
            glVertex2f((223-150)/150.0, - (245-150)/150.0);
            glVertex2f((222-150)/150.0, - (239-150)/150.0);
            glVertex2f((218-150)/150.0, - (233-150)/150.0);
            glVertex2f((217-150)/150.0, - (229-150)/150.0);
            glVertex2f((214-150)/150.0, - (226-150)/150.0);
            glVertex2f((211-150)/150.0, - (223-150)/150.0);
            glVertex2f((207-150)/150.0, - (220-150)/150.0);
            glVertex2f((202-150)/150.0, - (217-150)/150.0);
            glVertex2f((197-150)/150.0, - (214-150)/150.0);
            glVertex2f((187-150)/150.0, - (208-150)/150.0);
            glVertex2f((178-150)/150.0, - (207-150)/150.0);
            glVertex2f((174-150)/150.0, - (206-150)/150.0);
            glVertex2f((165-150)/150.0, - (206-150)/150.0);
            glVertex2f((156-150)/150.0, - (205-150)/150.0);
            glVertex2f((138-150)/150.0, - (208-150)/150.0);
            glVertex2f((130-150)/150.0, - (209-150)/150.0);
            glVertex2f((122-150)/150.0, - (211-150)/150.0);
        glEnd();
        glBegin(GL_POLYGON);
        glColor3ub(216,211,211);///body
            glVertex2f((68-150)/150.0, - (168-150)/150.0);
            glVertex2f((64-150)/150.0, - (169-150)/150.0);
            glVertex2f((63-150)/150.0, - (175-150)/150.0);
            glVertex2f((62-150)/150.0, - (180-150)/150.0);
            glVertex2f((62-150)/150.0, - (187-150)/150.0);
            glVertex2f((62-150)/150.0, - (187-150)/150.0);
            glVertex2f((63-150)/150.0, - (192-150)/150.0);
            glVertex2f((69-150)/150.0, - (199-150)/150.0);
            glVertex2f((76-150)/150.0, - (200-150)/150.0);
            glVertex2f((90-150)/150.0, - (201-150)/150.0);
            glVertex2f((114-150)/150.0, - (213-150)/150.0);
            glVertex2f((115-150)/150.0, - (213-150)/150.0);
            glVertex2f((120-150)/150.0, - (214-150)/150.0);
            glVertex2f((140-150)/150.0, - (216-150)/150.0);
            glVertex2f((148-150)/150.0, - (213-150)/150.0);
            glVertex2f((153-150)/150.0, - (210-150)/150.0);
            glVertex2f((156-150)/150.0, - (206-150)/150.0);
            glVertex2f((158-150)/150.0, - (203-150)/150.0);
            glVertex2f((163-150)/150.0, - (202-150)/150.0);
            glVertex2f((166-150)/150.0, - (202-150)/150.0);
            glVertex2f((169-150)/150.0, - (201-150)/150.0);
            glVertex2f((173-150)/150.0, - (201-150)/150.0);
            glVertex2f((180-150)/150.0, - (201-150)/150.0);
            glVertex2f((186-150)/150.0, - (201-150)/150.0);
            glVertex2f((197-150)/150.0, - (203-150)/150.0);
            glVertex2f((199-150)/150.0, - (204-150)/150.0);
            glVertex2f((205-150)/150.0, - (205-150)/150.0);
            glVertex2f((220-150)/150.0, - (209-150)/150.0);
            glVertex2f((220-150)/150.0, - (209-150)/150.0);
            glVertex2f((227-150)/150.0, - (214-150)/150.0);
            glVertex2f((230-150)/150.0, - (222-150)/150.0);
            glVertex2f((231-150)/150.0, - (227-150)/150.0);
            glVertex2f((231-150)/150.0, - (239-150)/150.0);
            glVertex2f((231-150)/150.0, - (240-150)/150.0);
            glVertex2f((231-150)/150.0, - (245-150)/150.0);
            glVertex2f((229-150)/150.0, - (251-150)/150.0);
            glVertex2f((227-150)/150.0, - (254-150)/150.0);
            glVertex2f((226-150)/150.0, - (258-150)/150.0);
            glVertex2f((225-150)/150.0, - (263-150)/150.0);
            glVertex2f((225-150)/150.0, - (264-150)/150.0);
            glVertex2f((225-150)/150.0, - (264-150)/150.0);
            glVertex2f((228-150)/150.0, - (260-150)/150.0);
            glVertex2f((232-150)/150.0, - (254-150)/150.0);
            glVertex2f((234-150)/150.0, - (249-150)/150.0);
            glVertex2f((236-150)/150.0, - (244-150)/150.0);
            glVertex2f((241-150)/150.0, - (237-150)/150.0);
            glVertex2f((244-150)/150.0, - (230-150)/150.0);
            glVertex2f((246-150)/150.0, - (225-150)/150.0);
            glVertex2f((246-150)/150.0, - (222-150)/150.0);
            glVertex2f((246-150)/150.0, - (218-150)/150.0);
            glVertex2f((248-150)/150.0, - (214-150)/150.0);
            glVertex2f((248-150)/150.0, - (212-150)/150.0);
            glVertex2f((249-150)/150.0, - (207-150)/150.0);
            glVertex2f((249-150)/150.0, - (203-150)/150.0);
            glVertex2f((250-150)/150.0, - (197-150)/150.0);
            glVertex2f((250-150)/150.0, - (193-150)/150.0);
            glVertex2f((250-150)/150.0, - (189-150)/150.0);
            glVertex2f((250-150)/150.0, - (182-150)/150.0);
            glVertex2f((252-150)/150.0, - (176-150)/150.0);
            glVertex2f((253-150)/150.0, - (173-150)/150.0);
            glVertex2f((253-150)/150.0, - (168-150)/150.0);
            glVertex2f((251-150)/150.0, - (164-150)/150.0);
            glVertex2f((250-150)/150.0, - (162-150)/150.0);
            glVertex2f((250-150)/150.0, - (158-150)/150.0);
            glVertex2f((250-150)/150.0, - (154-150)/150.0);
            glVertex2f((250-150)/150.0, - (150-150)/150.0);
            glVertex2f((250-150)/150.0, - (146-150)/150.0);
            glVertex2f((250-150)/150.0, - (143-150)/150.0);
            glVertex2f((250-150)/150.0, - (135-150)/150.0);
            glVertex2f((250-150)/150.0, - (133-150)/150.0);
            glVertex2f((249-150)/150.0, - (128-150)/150.0);
            glVertex2f((247-150)/150.0, - (121-150)/150.0);
            glVertex2f((246-150)/150.0, - (113-150)/150.0);
            glVertex2f((245-150)/150.0, - (108-150)/150.0);
            glVertex2f((245-150)/150.0, - (100-150)/150.0);
            glVertex2f((244-150)/150.0, - (97-150)/150.0);
            glVertex2f((244-150)/150.0, - (92-150)/150.0);
            glVertex2f((243-150)/150.0, - (88-150)/150.0);
            glVertex2f((242-150)/150.0, - (85-150)/150.0);
            glVertex2f((241-150)/150.0, - (79-150)/150.0);
            glVertex2f((239-150)/150.0, - (76-150)/150.0);
            glVertex2f((238-150)/150.0, - (76-150)/150.0);
            glVertex2f((234-150)/150.0, - (69-150)/150.0);
            glVertex2f((233-150)/150.0, - (67-150)/150.0);
            glVertex2f((231-150)/150.0, - (64-150)/150.0);
            glVertex2f((227-150)/150.0, - (58-150)/150.0);
            glVertex2f((223-150)/150.0, - (54-150)/150.0);
            glVertex2f((218-150)/150.0, - (51-150)/150.0);
            glVertex2f((214-150)/150.0, - (48-150)/150.0);
            glVertex2f((206-150)/150.0, - (44-150)/150.0);
            glVertex2f((198-150)/150.0, - (41-150)/150.0);
            glVertex2f((194-150)/150.0, - (40-150)/150.0);
            glVertex2f((183-150)/150.0, - (40-150)/150.0);
            glVertex2f((172-150)/150.0, - (40-150)/150.0);
            glVertex2f((172-150)/150.0, - (40-150)/150.0);
            glVertex2f((164-150)/150.0, - (40-150)/150.0);
            glVertex2f((156-150)/150.0, - (40-150)/150.0);
            glVertex2f((148-150)/150.0, - (40-150)/150.0);
            glVertex2f((137-150)/150.0, - (40-150)/150.0);
            glVertex2f((137-150)/150.0, - (40-150)/150.0);
            glVertex2f((121-150)/150.0, - (41-150)/150.0);
            glVertex2f((112-150)/150.0, - (44-150)/150.0);
            glVertex2f((112-150)/150.0, - (44-150)/150.0);
            glVertex2f((89-150)/150.0, - (46-150)/150.0);
            glVertex2f((87-150)/150.0, - (50-150)/150.0);
            glVertex2f((85-150)/150.0, - (52-150)/150.0);
            glVertex2f((82-150)/150.0, - (56-150)/150.0);
            glVertex2f((79-150)/150.0, - (59-150)/150.0);
            glVertex2f((77-150)/150.0, - (61-150)/150.0);
            glVertex2f((71-150)/150.0, - (66-150)/150.0);
            glVertex2f((70-150)/150.0, - (68-150)/150.0);
            glVertex2f((70-150)/150.0, - (72-150)/150.0);
            glVertex2f((68-150)/150.0, - (75-150)/150.0);
            glVertex2f((68-150)/150.0, - (77-150)/150.0);
            glVertex2f((67-150)/150.0, - (81-150)/150.0);
            glVertex2f((65-150)/150.0, - (85-150)/150.0);
            glVertex2f((63-150)/150.0, - (92-150)/150.0);
            glVertex2f((63-150)/150.0, - (94-150)/150.0);
            glVertex2f((63-150)/150.0, - (99-150)/150.0);
            glVertex2f((63-150)/150.0, - (105-150)/150.0);
            glVertex2f((63-150)/150.0, - (111-150)/150.0);
            glVertex2f((65-150)/150.0, - (120-150)/150.0);
            glVertex2f((68-150)/150.0, - (128-150)/150.0);
        glEnd();
        glBegin(GL_POLYGON);
        glColor3ub(238,233,233);///face
            glVertex2f((78-150)/150.0, - (96-150)/150.0);
            glVertex2f((72-150)/150.0, - (93-150)/150.0);
            glVertex2f((68-150)/150.0, - (90-150)/150.0);
            glVertex2f((60-150)/150.0, - (90-150)/150.0);
            glVertex2f((53-150)/150.0, - (93-150)/150.0);
            glVertex2f((46-150)/150.0, - (93-150)/150.0);
            glVertex2f((39-150)/150.0, - (98-150)/150.0);
            glVertex2f((33-150)/150.0, - (106-150)/150.0);
            glVertex2f((31-150)/150.0, - (114-150)/150.0);
            glVertex2f((29-150)/150.0, - (122-150)/150.0);
            glVertex2f((27-150)/150.0, - (135-150)/150.0);
            glVertex2f((32-150)/150.0, - (140-150)/150.0);
            glVertex2f((40-150)/150.0, - (149-150)/150.0);
            glVertex2f((46-150)/150.0, - (152-150)/150.0);
            glVertex2f((56-150)/150.0, - (153-150)/150.0);
            glVertex2f((64-150)/150.0, - (151-150)/150.0);
            glVertex2f((72-150)/150.0, - (151-150)/150.0);
            glVertex2f((81-150)/150.0, - (147-150)/150.0);
            glVertex2f((89-150)/150.0, - (144-150)/150.0);
            glVertex2f((97-150)/150.0, - (141-150)/150.0);
            glVertex2f((102-150)/150.0, - (139-150)/150.0);
            glVertex2f((108-150)/150.0, - (137-150)/150.0);
            glVertex2f((112-150)/150.0, - (136-150)/150.0);
            glVertex2f((115-150)/150.0, - (141-150)/150.0);
            glVertex2f((124-150)/150.0, - (147-150)/150.0);
            glVertex2f((131-150)/150.0, - (151-150)/150.0);
            glVertex2f((137-150)/150.0, - (154-150)/150.0);
            glVertex2f((142-150)/150.0, - (156-150)/150.0);
            glVertex2f((148-150)/150.0, - (157-150)/150.0);
            glVertex2f((155-150)/150.0, - (159-150)/150.0);
            glVertex2f((160-150)/150.0, - (159-150)/150.0);
            glVertex2f((169-150)/150.0, - (160-150)/150.0);
            glVertex2f((173-150)/150.0, - (160-150)/150.0);
            glVertex2f((181-150)/150.0, - (161-150)/150.0);
            glVertex2f((190-150)/150.0, - (159-150)/150.0);
            glVertex2f((201-150)/150.0, - (157-150)/150.0);
            glVertex2f((210-150)/150.0, - (154-150)/150.0);
            glVertex2f((215-150)/150.0, - (149-150)/150.0);
            glVertex2f((218-150)/150.0, - (143-150)/150.0);
            glVertex2f((221-150)/150.0, - (134-150)/150.0);
            glVertex2f((221-150)/150.0, - (126-150)/150.0);
            glVertex2f((219-150)/150.0, - (116-150)/150.0);
            glVertex2f((213-150)/150.0, - (108-150)/150.0);
            glVertex2f((208-150)/150.0, - (104-150)/150.0);
            glVertex2f((198-150)/150.0, - (100-150)/150.0);
            glVertex2f((186-150)/150.0, - (100-150)/150.0);
            glVertex2f((178-150)/150.0, - (100-150)/150.0);
            glVertex2f((170-150)/150.0, - (100-150)/150.0);
            glVertex2f((156-150)/150.0, - (102-150)/150.0);
            glVertex2f((150-150)/150.0, - (102-150)/150.0);
            glVertex2f((141-150)/150.0, - (102-150)/150.0);
            glVertex2f((131-150)/150.0, - (104-150)/150.0);
            glVertex2f((120-150)/150.0, - (101-150)/150.0);
            glVertex2f((113-150)/150.0, - (101-150)/150.0);
            glVertex2f((102-150)/150.0, - (101-150)/150.0);
            glVertex2f((93-150)/150.0, - (101-150)/150.0);
            glVertex2f((83-150)/150.0, - (97-150)/150.0);
        glEnd();
        glBegin(GL_POLYGON);
        glColor3ub(238,233,233);///face
            glVertex2f((28-150)/150.0, - (136-150)/150.0);
            glVertex2f((31-150)/150.0, - (145-150)/150.0);
            glVertex2f((36-150)/150.0, - (152-150)/150.0);
            glVertex2f((42-150)/150.0, - (160-150)/150.0);
            glVertex2f((56-150)/150.0, - (164-150)/150.0);
            glVertex2f((64-150)/150.0, - (163-150)/150.0);
            glVertex2f((75-150)/150.0, - (160-150)/150.0);
            glVertex2f((84-150)/150.0, - (157-150)/150.0);
            glVertex2f((93-150)/150.0, - (153-150)/150.0);
            glVertex2f((99-150)/150.0, - (150-150)/150.0);
            glVertex2f((105-150)/150.0, - (145-150)/150.0);
            glVertex2f((109-150)/150.0, - (144-150)/150.0);
            glVertex2f((112-150)/150.0, - (144-150)/150.0);
            glVertex2f((114-150)/150.0, - (144-150)/150.0);
            glVertex2f((118-150)/150.0, - (144-150)/150.0);
            glVertex2f((122-150)/150.0, - (143-150)/150.0);
            glVertex2f((124-150)/150.0, - (134-150)/150.0);
            glVertex2f((123-150)/150.0, - (129-150)/150.0);
        glEnd();

        glBegin(GL_POLYGON);///屁股修改
       glColor3ub(238,233,233);
            glVertex2f((135-150)/150.0, - (216-150)/150.0);
            glVertex2f((141-150)/150.0, - (211-150)/150.0);
            glVertex2f((147-150)/150.0, - (208-150)/150.0);
            glVertex2f((155-150)/150.0, - (206-150)/150.0);
            glVertex2f((171-150)/150.0, - (203-150)/150.0);
            glVertex2f((171-150)/150.0, - (203-150)/150.0);
            glVertex2f((180-150)/150.0, - (203-150)/150.0);
            glVertex2f((184-150)/150.0, - (204-150)/150.0);
            glVertex2f((190-150)/150.0, - (207-150)/150.0);
            glVertex2f((195-150)/150.0, - (207-150)/150.0);
            glVertex2f((198-150)/150.0, - (207-150)/150.0);
            glVertex2f((203-150)/150.0, - (209-150)/150.0);
            glVertex2f((206-150)/150.0, - (214-150)/150.0);
            glVertex2f((207-150)/150.0, - (215-150)/150.0);
            glVertex2f((209-150)/150.0, - (217-150)/150.0);
            glVertex2f((215-150)/150.0, - (222-150)/150.0);
            glVertex2f((217-150)/150.0, - (229-150)/150.0);
            glVertex2f((219-150)/150.0, - (236-150)/150.0);
            glVertex2f((220-150)/150.0, - (238-150)/150.0);
            glVertex2f((222-150)/150.0, - (242-150)/150.0);
            glVertex2f((223-150)/150.0, - (249-150)/150.0);
            glVertex2f((224-150)/150.0, - (260-150)/150.0);
            glVertex2f((224-150)/150.0, - (263-150)/150.0);
            glVertex2f((216-150)/150.0, - (269-150)/150.0);
            glVertex2f((214-150)/150.0, - (271-150)/150.0);
            glVertex2f((209-150)/150.0, - (275-150)/150.0);
            glVertex2f((204-150)/150.0, - (279-150)/150.0);
            glVertex2f((197-150)/150.0, - (282-150)/150.0);
            glVertex2f((189-150)/150.0, - (286-150)/150.0);
            glVertex2f((185-150)/150.0, - (287-150)/150.0);
            glVertex2f((181-150)/150.0, - (287-150)/150.0);
            glVertex2f((178-150)/150.0, - (287-150)/150.0);
            glVertex2f((171-150)/150.0, - (287-150)/150.0);
            glVertex2f((165-150)/150.0, - (287-150)/150.0);
            glVertex2f((156-150)/150.0, - (287-150)/150.0);
            glVertex2f((152-150)/150.0, - (286-150)/150.0);
            glVertex2f((145-150)/150.0, - (283-150)/150.0);
            glVertex2f((142-150)/150.0, - (281-150)/150.0);
            glVertex2f((136-150)/150.0, - (278-150)/150.0);
            glVertex2f((132-150)/150.0, - (273-150)/150.0);
            glVertex2f((127-150)/150.0, - (264-150)/150.0);
            glVertex2f((124-150)/150.0, - (256-150)/150.0);
        glEnd();

        glBegin(GL_POLYGON);///nose
        glColor3ub(255,193,226);
            glVertex2f((108-150)/150.0, - (120-150)/150.0);
            glVertex2f((112-150)/150.0, - (124-150)/150.0);
            glVertex2f((113-150)/150.0, - (125-150)/150.0);
            glVertex2f((119-150)/150.0, - (122-150)/150.0);
            glVertex2f((121-150)/150.0, - (119-150)/150.0);
            glVertex2f((117-150)/150.0, - (118-150)/150.0);
            glVertex2f((111-150)/150.0, - (118-150)/150.0);
        glEnd();
        glBegin(GL_POLYGON);///eyes
        glColor3ub(0,0,0);
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
            {
            glVertex2f(0.09*cos(angle)+0.15,-0.12*sin(angle)+0.32);
            }
        glEnd();
        glBegin(GL_POLYGON);
        glColor3ub(0,0,0);
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
            {
            glVertex2f(0.09*cos(angle)-0.39,-0.12*sin(angle)+0.34);
            }
        glEnd();
        glBegin(GL_POLYGON);
        glColor3ub(255,255,255);
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
            {
            glVertex2f(0.02*cos(angle)+0.11,-0.02*sin(angle)+0.4);
            }
        glEnd();
         glBegin(GL_POLYGON);
        glColor3ub(255,255,255);
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
            {
            glVertex2f(0.02*cos(angle)-0.42,-0.02*sin(angle)+0.42);
            }
        glEnd();

        glBegin(GL_POLYGON);///rightfoot
        glColor3ub(248,247,247);
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
                {
                glVertex2f(0.08*cos(angle)+0.11,-0.13*sin(angle)-0.63);
                }
        glEnd();

        glBegin(GL_POLYGON);///sead
        glColor3ub(0,0,0);
       glVertex2f((113-150)/150.0, - (137-150)/150.0);
            glVertex2f((107-150)/150.0, - (140-150)/150.0);
            glVertex2f((102-150)/150.0, - (148-150)/150.0);
            glVertex2f((99-150)/150.0, - (154-150)/150.0);
            glVertex2f((94-150)/150.0, - (170-150)/150.0);
            glVertex2f((94-150)/150.0, - (181-150)/150.0);
            glVertex2f((96-150)/150.0, - (190-150)/150.0);
            glVertex2f((100-150)/150.0, - (202-150)/150.0);
            glVertex2f((106-150)/150.0, - (204-150)/150.0);
            glVertex2f((115-150)/150.0, - (206-150)/150.0);
            glVertex2f((122-150)/150.0, - (205-150)/150.0);
            glVertex2f((130-150)/150.0, - (200-150)/150.0);
            glVertex2f((139-150)/150.0, - (195-150)/150.0);
            glVertex2f((139-150)/150.0, - (185-150)/150.0);
            glVertex2f((137-150)/150.0, - (174-150)/150.0);
            glVertex2f((135-150)/150.0, - (167-150)/150.0);
            glVertex2f((129-150)/150.0, - (157-150)/150.0);
            glVertex2f((125-150)/150.0, - (150-150)/150.0);
            glVertex2f((118-150)/150.0, - (144-150)/150.0);
            glVertex2f((117-150)/150.0, - (141-150)/150.0);
        glEnd();
        glLineWidth(8);
         glBegin(GL_LINES);
         glColor3ub(102,101,101);
            glVertex2f((125-150)/150.0, - (40-150)/150.0);
            glVertex2f((119-150)/150.0, - (51-150)/150.0);
            glVertex2f((119-150)/150.0, - (51-150)/150.0);
            glVertex2f((116-150)/150.0, - (66-150)/150.0);
            glVertex2f((140-150)/150.0, - (40-150)/150.0);
            glVertex2f((134-150)/150.0, - (54-150)/150.0);
            glVertex2f((134-150)/150.0, - (54-150)/150.0);
            glVertex2f((134-150)/150.0, - (66-150)/150.0);
            glVertex2f((161-150)/150.0, - (41-150)/150.0);
            glVertex2f((153-150)/150.0, - (53-150)/150.0);
            glVertex2f((153-150)/150.0, - (53-150)/150.0);
            glVertex2f((153-150)/150.0, - (66-150)/150.0);

        glEnd();
        glLineWidth(3);
         glBegin(GL_LINES);
         glColor3ub(255,255,255);
            glVertex2f((110-150)/150.0, - (138-150)/150.0);
            glVertex2f((96-150)/150.0, - (162-150)/150.0);
            glVertex2f((96-150)/150.0, - (162-150)/150.0);
            glVertex2f((96-150)/150.0, - (178-150)/150.0);
            glVertex2f((96-150)/150.0, - (178-150)/150.0);
            glVertex2f((101-150)/150.0, - (191-150)/150.0);
            glVertex2f((101-150)/150.0, - (191-150)/150.0);
            glVertex2f((106-150)/150.0, - (199-150)/150.0);
            glVertex2f((109-150)/150.0, - (140-150)/150.0);
            glVertex2f((104-150)/150.0, - (164-150)/150.0);
            glVertex2f((104-150)/150.0, - (164-150)/150.0);
            glVertex2f((107-150)/150.0, - (182-150)/150.0);
            glVertex2f((107-150)/150.0, - (182-150)/150.0);
            glVertex2f((111-150)/150.0, - (200-150)/150.0);
            glVertex2f((111-150)/150.0, - (138-150)/150.0);
            glVertex2f((119-150)/150.0, - (161-150)/150.0);
            glVertex2f((119-150)/150.0, - (161-150)/150.0);
            glVertex2f((124-150)/150.0, - (170-150)/150.0);
            glVertex2f((124-150)/150.0, - (170-150)/150.0);
            glVertex2f((122-150)/150.0, - (186-150)/150.0);
            glVertex2f((122-150)/150.0, - (186-150)/150.0);
            glVertex2f((114-150)/150.0, - (203-150)/150.0);
            glVertex2f((113-150)/150.0, - (139-150)/150.0);
            glVertex2f((124-150)/150.0, - (152-150)/150.0);
            glVertex2f((124-150)/150.0, - (152-150)/150.0);
            glVertex2f((130-150)/150.0, - (164-150)/150.0);
            glVertex2f((130-150)/150.0, - (164-150)/150.0);
            glVertex2f((133-150)/150.0, - (185-150)/150.0);
            glVertex2f((133-150)/150.0, - (185-150)/150.0);
            glVertex2f((117-150)/150.0, - (201-150)/150.0);
            glVertex2f((112-150)/150.0, - (139-150)/150.0);
            glVertex2f((113-150)/150.0, - (200-150)/150.0);


    glEnd();
        glLineWidth(2);///footline
        glBegin(GL_LINES);
            glColor3ub(0,0,0);
            glVertex2f((166-150)/150.0, - (224-150)/150.0);
            glVertex2f((163-150)/150.0, - (233-150)/150.0);
            glVertex2f((171-150)/150.0, - (225-150)/150.0);
            glVertex2f((170-150)/150.0, - (233-150)/150.0);


            glVertex2f((28-150)/150.0, - (208-150)/150.0);
            glVertex2f((26-150)/150.0, - (214-150)/150.0);
            glVertex2f((32-150)/150.0, - (209-150)/150.0);
            glVertex2f((31-150)/150.0, - (216-150)/150.0);


                glEnd();
         glBegin(GL_POLYGON);
        glColor3ub(243,240,240);///hand
            glVertex2f((89-150)/150.0, - (167-150)/150.0);
            glVertex2f((96-150)/150.0, - (163-150)/150.0);
            glVertex2f((101-150)/150.0, - (162-150)/150.0);
            glVertex2f((103-150)/150.0, - (167-150)/150.0);
            glVertex2f((102-150)/150.0, - (174-150)/150.0);
            glVertex2f((99-150)/150.0, - (177-150)/150.0);
            glVertex2f((95-150)/150.0, - (182-150)/150.0);
            glVertex2f((93-150)/150.0, - (184-150)/150.0);

        glEnd();
         glBegin(GL_POLYGON);
         glColor3ub(243,240,240);
            glVertex2f((158-150)/150.0, - (171-150)/150.0);
            glVertex2f((154-150)/150.0, - (170-150)/150.0);
            glVertex2f((146-150)/150.0, - (170-150)/150.0);
            glVertex2f((138-150)/150.0, - (170-150)/150.0);
            glVertex2f((133-150)/150.0, - (169-150)/150.0);
            glVertex2f((129-150)/150.0, - (169-150)/150.0);
            glVertex2f((127-150)/150.0, - (171-150)/150.0);
            glVertex2f((126-150)/150.0, - (171-150)/150.0);
            glVertex2f((127-150)/150.0, - (174-150)/150.0);
            glVertex2f((128-150)/150.0, - (176-150)/150.0);
            glVertex2f((130-150)/150.0, - (178-150)/150.0);
            glVertex2f((132-150)/150.0, - (180-150)/150.0);
            glVertex2f((137-150)/150.0, - (183-150)/150.0);
            glVertex2f((139-150)/150.0, - (183-150)/150.0);
            glVertex2f((143-150)/150.0, - (187-150)/150.0);
            glVertex2f((147-150)/150.0, - (189-150)/150.0);
            glVertex2f((151-150)/150.0, - (193-150)/150.0);
            glVertex2f((153-150)/150.0, - (195-150)/150.0);
        glEnd();


    glBegin(GL_POLYGON);
    glColor3ub(255,174,200);///ear
            for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
            {
            glVertex2f(0.13*cos(angle)+0.46,-0.1*sin(angle)+0.69);
            }
    glEnd();
        glBegin(GL_POLYGON);
         glColor3ub(197,196,196);
            glVertex2f((202-150)/150.0, - (58-150)/150.0);
            glVertex2f((205-150)/150.0, - (52-150)/150.0);
            glVertex2f((212-150)/150.0, - (47-150)/150.0);
            glVertex2f((217-150)/150.0, - (45-150)/150.0);
            glVertex2f((226-150)/150.0, - (45-150)/150.0);
            glVertex2f((231-150)/150.0, - (47-150)/150.0);
            glVertex2f((234-150)/150.0, - (47-150)/150.0);
            glVertex2f((238-150)/150.0, - (50-150)/150.0);
            glVertex2f((240-150)/150.0, - (43-150)/150.0);
            glVertex2f((242-150)/150.0, - (40-150)/150.0);
            glVertex2f((240-150)/150.0, - (35-150)/150.0);
            glVertex2f((236-150)/150.0, - (32-150)/150.0);
            glVertex2f((229-150)/150.0, - (29-150)/150.0);
            glVertex2f((220-150)/150.0, - (28-150)/150.0);
            glVertex2f((215-150)/150.0, - (29-150)/150.0);
            glVertex2f((208-150)/150.0, - (31-150)/150.0);
            glVertex2f((202-150)/150.0, - (34-150)/150.0);
            glVertex2f((197-150)/150.0, - (38-150)/150.0);
            glVertex2f((189-150)/150.0, - (44-150)/150.0);

        glEnd();
glutSwapBuffers();
}

void mouse(int button, int state, int x, int y)
{
    if(state==GLUT_DOWN)
    {
    printf("glVertex2f((%d-150)/150.0, - (%d-150)/150.0);\n",x,y);
    }
}

int main(int argc, char**argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("Week03");

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


沒有留言:

張貼留言