2020年3月17日 星期二

第三週不是很快樂的卡小

豪,來,大ㄚ
我們先來複習上次ㄉ內容ㄅ

先打開CodeBlocks然後ㄅㄧㄨˋㄅㄧㄨˋㄅㄧㄨˋ的
就變醬子ㄌ,欸嘿キタ━━━━(゚∀゚)━━━━!!
ㄎㄎ,豪啦沒有,詳情去看第二週ㄉ卡小ㄅ
我把上週所有內容都放在那裡ㄌ!

回歸正題,第三週開始學習滑鼠相關ㄉ東西
先加入使用滑鼠要使用ㄉ函數
就是圈起來ㄉ那ㄍ辣!
輸入mouse要使用ㄉ參數
然後輸出看滑鼠點擊的座標位置、左中右鍵、按下或放開

之後跑程式,點擊小視窗任意移處就豪囉!(*‘ v`*)


ㄅ過小黑窗顯示ㄉ數字是0~300
我們想要ㄉ是-1~1
So,先把x跟y減掉150
安捏就是-150~150了唷
然後除以150.0,就變成-1.0~1.0豪耶!
除此之外,要讓茶壺可以跟著滑鼠點擊ㄉ位置移動
先在最外層宣告移動茶壺要使用ㄉ變數teapotX&teapotY
要給teapotX跟teapotYㄉ數一樣要是-1.0~1.0哦!
然後背景也要先清除,ㄅ然就會看到很多ㄍ茶壺
根本ㄅ知道到底哪ㄍ才是剛剛弄ㄉ辣!
然後備份矩陣做紀錄

執行程式就變醬辣!
中間很多地方都沒有截圖,因為我來不及辣!
起司蛋餅辣!


 現在用滑鼠畫圖辣!
先把剛剛跟茶壺有關ㄉ程式碼刪掉辣!
變成上圖那樣辣!
然後一樣給他一ㄍ開始跟結束

點擊按鈕時會顯示座標

點擊左鍵畫出泥想要ㄉ圖形
之後複製座標

把座標貼到Being裡
然後do re mi so !

醜死人不成形ㄉ星星就完成囉!







附上回家作業需用ㄉ程式碼辣!
#include <GL/glut.h>
#include <stdio.h>
#include <math.h>
float teapotX=0,teapotY=0;

void display(void)
{
     glClearColor(0,(78/255.0),(225/255.0),1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glBegin(GL_POLYGON);///星星左
     glColor3f(0.0,0.0,0.0);
    glVertex2f((115-150)/150.0, - (232-150)/150.0);
    glVertex2f((110-150)/150.0, - (242-150)/150.0);
    glVertex2f((120-150)/150.0, - (242-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((110-150)/150.0, - (242-150)/150.0);
    glVertex2f((100-150)/150.0, - (242-150)/150.0);
    glVertex2f((108-150)/150.0, - (250-150)/150.0);
    glVertex2f((104-150)/150.0, - (261-150)/150.0);
    glVertex2f((115-150)/150.0, - (255-150)/150.0);
    glVertex2f((124-150)/150.0, - (261-150)/150.0);
    glVertex2f((122-150)/150.0, - (250-150)/150.0);
    glVertex2f((129-150)/150.0, - (242-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///星星中
    glColor3f(0.0,0.0,0.0);
    glVertex2f((150-150)/150.0, - (250-150)/150.0);
    glVertex2f((145-150)/150.0, - (260-150)/150.0);
    glVertex2f((154-150)/150.0, - (260-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glVertex2f((145-150)/150.0, - (260-150)/150.0);
    glVertex2f((135-150)/150.0, - (260-150)/150.0);
    glVertex2f((142-150)/150.0, - (265-150)/150.0);
    glVertex2f((139-150)/150.0, - (275-150)/150.0);
    glVertex2f((150-150)/150.0, - (270-150)/150.0);
    glVertex2f((160-150)/150.0, - (275-150)/150.0);
    glVertex2f((156-150)/150.0, - (265-150)/150.0);
    glVertex2f((165-150)/150.0, - (260-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///星星右
    glColor3f(0.0,0.0,0.0);
    glVertex2f((183-150)/150.0, - (232-150)/150.0);
    glVertex2f((178-150)/150.0, - (242-150)/150.0);
    glVertex2f((187-150)/150.0, - (242-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((178-150)/150.0, - (242-150)/150.0);
    glVertex2f((168-150)/150.0, - (242-150)/150.0);
    glVertex2f((175-150)/150.0, - (250-150)/150.0);
    glVertex2f((173-150)/150.0, - (261-150)/150.0);
    glVertex2f((183-150)/150.0, - (255-150)/150.0);
    glVertex2f((193-150)/150.0, - (261-150)/150.0);
    glVertex2f((190-150)/150.0, - (250-150)/150.0);
    glVertex2f((198-150)/150.0, - (242-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///骷髏下巴
    glColor3f(0.0,0.0,0.0);
    glVertex2f((112-150)/150.0, - (181-150)/150.0);
    glVertex2f((114-150)/150.0, - (203-150)/150.0);
    glVertex2f((115-150)/150.0, - (209-150)/150.0);
    glVertex2f((117-150)/150.0, - (213-150)/150.0);
    glVertex2f((120-150)/150.0, - (216-150)/150.0);
    glVertex2f((124-150)/150.0, - (219-150)/150.0);
    glVertex2f((138-150)/150.0, - (226-150)/150.0);
    glVertex2f((141-150)/150.0, - (228-150)/150.0);
    glVertex2f((145-150)/150.0, - (229-150)/150.0);
    glVertex2f((149-150)/150.0, - (230-150)/150.0);
    glVertex2f((153-150)/150.0, - (230-150)/150.0);
    glVertex2f((158-150)/150.0, - (228-150)/150.0);
    glVertex2f((163-150)/150.0, - (225-150)/150.0);
    glVertex2f((176-150)/150.0, - (218-150)/150.0);
    glVertex2f((180-150)/150.0, - (214-150)/150.0);
    glVertex2f((183-150)/150.0, - (212-150)/150.0);
    glVertex2f((184-150)/150.0, - (210-150)/150.0);
    glVertex2f((185-150)/150.0, - (207-150)/150.0);
    glVertex2f((185-150)/150.0, - (202-150)/150.0);
    glVertex2f((186-150)/150.0, - (193-150)/150.0);
    glVertex2f((187-150)/150.0, - (187-150)/150.0);
    glVertex2f((187-150)/150.0, - (181-150)/150.0);
    glVertex2f((181-150)/150.0, - (183-150)/150.0);
    glVertex2f((119-150)/150.0, - (183-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(0,78,225);
    glVertex2f((117-150)/150.0, - (180-150)/150.0);
    glVertex2f((120-150)/150.0, - (191-150)/150.0);
    glVertex2f((125-150)/150.0, - (202-150)/150.0);
    glVertex2f((148-150)/150.0, - (204-150)/150.0);
    glVertex2f((174-150)/150.0, - (202-150)/150.0);
    glVertex2f((178-150)/150.0, - (192-150)/150.0);
    glVertex2f((181-150)/150.0, - (180-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///齒1
    glColor3f(0.0,0.0,0.0);
    glVertex2f((123-150)/150.0, - (186-150)/150.0);
    glVertex2f((126-150)/150.0, - (194-150)/150.0);
    glVertex2f((131-150)/150.0, - (193-150)/150.0);
    glVertex2f((130-150)/150.0, - (187-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((126-150)/150.0, - (195-150)/150.0);
    glVertex2f((126-150)/150.0, - (200-150)/150.0);
    glVertex2f((130-150)/150.0, - (201-150)/150.0);
    glVertex2f((131-150)/150.0, - (195-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///齒2
    glColor3f(0.0,0.0,0.0);
    glVertex2f((132-150)/150.0, - (188-150)/150.0);
    glVertex2f((133-150)/150.0, - (196-150)/150.0);
    glVertex2f((136-150)/150.0, - (196-150)/150.0);
    glVertex2f((137-150)/150.0, - (188-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((134-150)/150.0, - (197-150)/150.0);
    glVertex2f((133-150)/150.0, - (201-150)/150.0);
    glVertex2f((137-150)/150.0, - (201-150)/150.0);
    glVertex2f((137-150)/150.0, - (197-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///齒3
    glColor3f(0.0,0.0,0.0);
    glVertex2f((139-150)/150.0, - (189-150)/150.0);
    glVertex2f((139-150)/150.0, - (194-150)/150.0);
    glVertex2f((143-150)/150.0, - (194-150)/150.0);
    glVertex2f((143-150)/150.0, - (189-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((139-150)/150.0, - (195-150)/150.0);
    glVertex2f((139-150)/150.0, - (201-150)/150.0);
    glVertex2f((142-150)/150.0, - (201-150)/150.0);
    glVertex2f((142-150)/150.0, - (195-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///齒4
    glColor3f(0.0,0.0,0.0);
    glVertex2f((144-150)/150.0, - (189-150)/150.0);
    glVertex2f((144-150)/150.0, - (194-150)/150.0);
    glVertex2f((148-150)/150.0, - (194-150)/150.0);
    glVertex2f((148-150)/150.0, - (189-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((144-150)/150.0, - (195-150)/150.0);
    glVertex2f((144-150)/150.0, - (202-150)/150.0);
    glVertex2f((148-150)/150.0, - (202-150)/150.0);
    glVertex2f((148-150)/150.0, - (195-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///齒5
    glColor3f(0.0,0.0,0.0);
    glVertex2f((150-150)/150.0, - (190-150)/150.0);
    glVertex2f((150-150)/150.0, - (194-150)/150.0);
    glVertex2f((154-150)/150.0, - (194-150)/150.0);
    glVertex2f((154-150)/150.0, - (190-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((150-150)/150.0, - (196-150)/150.0);
    glVertex2f((150-150)/150.0, - (202-150)/150.0);
    glVertex2f((154-150)/150.0, - (202-150)/150.0);
    glVertex2f((154-150)/150.0, - (196-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///齒6
    glColor3f(0.0,0.0,0.0);
    glVertex2f((156-150)/150.0, - (190-150)/150.0);
    glVertex2f((156-150)/150.0, - (193-150)/150.0);
    glVertex2f((160-150)/150.0, - (194-150)/150.0);
    glVertex2f((160-150)/150.0, - (190-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((156-150)/150.0, - (196-150)/150.0);
    glVertex2f((156-150)/150.0, - (202-150)/150.0);
    glVertex2f((158-150)/150.0, - (202-150)/150.0);
    glVertex2f((160-150)/150.0, - (201-150)/150.0);
    glVertex2f((160-150)/150.0, - (196-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///齒7
    glColor3f(0.0,0.0,0.0);
    glVertex2f((162-150)/150.0, - (189-150)/150.0);
    glVertex2f((163-150)/150.0, - (196-150)/150.0);
    glVertex2f((166-150)/150.0, - (196-150)/150.0);
    glVertex2f((167-150)/150.0, - (189-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((163-150)/150.0, - (199-150)/150.0);
    glVertex2f((163-150)/150.0, - (201-150)/150.0);
    glVertex2f((166-150)/150.0, - (201-150)/150.0);
    glVertex2f((166-150)/150.0, - (199-150)/150.0);
    glVertex2f((164-150)/150.0, - (197-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///齒8
    glColor3f(0.0,0.0,0.0);
    glVertex2f((169-150)/150.0, - (189-150)/150.0);
    glVertex2f((169-150)/150.0, - (194-150)/150.0);
    glVertex2f((172-150)/150.0, - (195-150)/150.0);
    glVertex2f((175-150)/150.0, - (187-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((169-150)/150.0, - (196-150)/150.0);
    glVertex2f((169-150)/150.0, - (200-150)/150.0);
    glVertex2f((172-150)/150.0, - (200-150)/150.0);
    glVertex2f((173-150)/150.0, - (196-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///上半
    glColor3f(0.0,0.0,0.0);
    glVertex2f((127-150)/150.0, - (186-150)/150.0);
    glVertex2f((171-150)/150.0, - (186-150)/150.0);
    glVertex2f((173-150)/150.0, - (184-150)/150.0);
    glVertex2f((174-150)/150.0, - (182-150)/150.0);
    glVertex2f((176-150)/150.0, - (181-150)/150.0);
    glVertex2f((179-150)/150.0, - (179-150)/150.0);
    glVertex2f((181-150)/150.0, - (178-150)/150.0);
    glVertex2f((183-150)/150.0, - (176-150)/150.0);
    glVertex2f((186-150)/150.0, - (176-150)/150.0);
    glVertex2f((189-150)/150.0, - (175-150)/150.0);
    glVertex2f((193-150)/150.0, - (175-150)/150.0);
    glVertex2f((198-150)/150.0, - (167-150)/150.0);
    glVertex2f((198-150)/150.0, - (164-150)/150.0);
    glVertex2f((197-150)/150.0, - (162-150)/150.0);
    glVertex2f((195-150)/150.0, - (158-150)/150.0);
    glVertex2f((194-150)/150.0, - (156-150)/150.0);
    glVertex2f((194-150)/150.0, - (142-150)/150.0);
    glVertex2f((193-150)/150.0, - (139-150)/150.0);
    glVertex2f((190-150)/150.0, - (133-150)/150.0);
    glVertex2f((189-150)/150.0, - (129-150)/150.0);
    glVertex2f((188-150)/150.0, - (126-150)/150.0);
    glVertex2f((188-150)/150.0, - (124-150)/150.0);
    glVertex2f((191-150)/150.0, - (115-150)/150.0);

    glVertex2f((107-150)/150.0, - (114-150)/150.0);
    glVertex2f((110-150)/150.0, - (126-150)/150.0);
    glVertex2f((112-150)/150.0, - (129-150)/150.0);
    glVertex2f((109-150)/150.0, - (132-150)/150.0);
    glVertex2f((108-150)/150.0, - (134-150)/150.0);
    glVertex2f((106-150)/150.0, - (139-150)/150.0);
    glVertex2f((104-150)/150.0, - (142-150)/150.0);
    glVertex2f((105-150)/150.0, - (153-150)/150.0);
    glVertex2f((105-150)/150.0, - (156-150)/150.0);
    glVertex2f((104-150)/150.0, - (158-150)/150.0);
    glVertex2f((100-150)/150.0, - (164-150)/150.0);
    glVertex2f((100-150)/150.0, - (166-150)/150.0);
    glVertex2f((105-150)/150.0, - (174-150)/150.0);
    glVertex2f((106-150)/150.0, - (175-150)/150.0);
    glVertex2f((112-150)/150.0, - (176-150)/150.0);
    glVertex2f((116-150)/150.0, - (177-150)/150.0);
    glVertex2f((119-150)/150.0, - (179-150)/150.0);
    glVertex2f((123-150)/150.0, - (180-150)/150.0);
    glVertex2f((125-150)/150.0, - (184-150)/150.0);
    glVertex2f((127-150)/150.0, - (186-150)/150.0);

    glEnd();

    glBegin(GL_POLYGON);///HEAD
    glColor3ub(0,0,0);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.35*cos(angle),0.35*sin(angle)+0.15);
    }
    glEnd();

    glBegin(GL_POLYGON);///EYES
    glColor3ub(0,78,225);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.09*cos(angle)+0.15,0.09*sin(angle));
    }
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(0,78,225);
    for(float angle=0 ; angle<=3.1415926 * 2 ;angle+=0.01)
    {
    glVertex2f(0.09*cos(angle)-0.16,0.09*sin(angle));
    }
    glEnd();


    glBegin(GL_POLYGON);///鼻子
    glColor3ub(0,78,225);
    glVertex2f((149-150)/150.0, - (155-150)/150.0);
    glVertex2f((146-150)/150.0, - (162-150)/150.0);
    glVertex2f((141-150)/150.0, - (176-150)/150.0);
    glVertex2f((144-150)/150.0, - (180-150)/150.0);
    glVertex2f((149-150)/150.0, - (177-150)/150.0);
    glVertex2f((154-150)/150.0, - (180-150)/150.0);
    glVertex2f((157-150)/150.0, - (176-150)/150.0);
    glVertex2f((152-150)/150.0, - (161-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///MTC-M
    glColor3ub(0,78,225);
    glVertex2f((116-150)/150.0, - (96-150)/150.0);
    glVertex2f((115-150)/150.0, - (102-150)/150.0);
    glVertex2f((115-150)/150.0, - (106-150)/150.0);
    glVertex2f((116-150)/150.0, - (110-150)/150.0);
    glVertex2f((116-150)/150.0, - (115-150)/150.0);
    glVertex2f((117-150)/150.0, - (118-150)/150.0);
    glVertex2f((118-150)/150.0, - (122-150)/150.0);
    glVertex2f((122-150)/150.0, - (121-150)/150.0);
    glVertex2f((119-150)/150.0, - (102-150)/150.0);
    glVertex2f((121-150)/150.0, - (102-150)/150.0);
    glVertex2f((126-150)/150.0, - (119-150)/150.0);
    glVertex2f((129-150)/150.0, - (118-150)/150.0);
    glVertex2f((133-150)/150.0, - (96-150)/150.0);
    glVertex2f((128-150)/150.0, - (96-150)/150.0);
    glVertex2f((127-150)/150.0, - (110-150)/150.0);
    glVertex2f((121-150)/150.0, - (96-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((120-150)/150.0, - (96-150)/150.0);
    glVertex2f((127-150)/150.0, - (110-150)/150.0);
    glVertex2f((128-150)/150.0, - (96-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(0,78,225);
    glVertex2f((133-150)/150.0, - (102-150)/150.0);
    glVertex2f((136-150)/150.0, - (114-150)/150.0);
    glVertex2f((140-150)/150.0, - (113-150)/150.0);
    glVertex2f((137-150)/150.0, - (103-150)/150.0);
    glVertex2f((136-150)/150.0, - (97-150)/150.0);
    glVertex2f((135-150)/150.0, - (97-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///MTC-T
    glColor3ub(0,78,225);
    glVertex2f((148-150)/150.0, - (115-150)/150.0);
    glVertex2f((151-150)/150.0, - (112-150)/150.0);
    glVertex2f((151-150)/150.0, - (93-150)/150.0);
    glVertex2f((151-150)/150.0, - (84-150)/150.0);
    glVertex2f((150-150)/150.0, - (81-150)/150.0);
    glVertex2f((149-150)/150.0, - (81-150)/150.0);
    glVertex2f((147-150)/150.0, - (87-150)/150.0);
    glVertex2f((147-150)/150.0, - (90-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(0,78,225);
    glVertex2f((137-150)/150.0, - (89-150)/150.0);
    glVertex2f((139-150)/150.0, - (92-150)/150.0);
    glVertex2f((142-150)/150.0, - (89-150)/150.0);
    glVertex2f((146-150)/150.0, - (89-150)/150.0);
    glVertex2f((144-150)/150.0, - (85-150)/150.0);
    glVertex2f((140-150)/150.0, - (85-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(0,78,225);
    glVertex2f((153-150)/150.0, - (85-150)/150.0);
    glVertex2f((153-150)/150.0, - (89-150)/150.0);
    glVertex2f((156-150)/150.0, - (89-150)/150.0);
    glVertex2f((157-150)/150.0, - (92-150)/150.0);
    glVertex2f((161-150)/150.0, - (91-150)/150.0);
    glVertex2f((160-150)/150.0, - (88-150)/150.0);
    glVertex2f((158-150)/150.0, - (85-150)/150.0);
    glVertex2f((153-150)/150.0, - (85-150)/150.0);
    glEnd();

    glBegin(GL_POLYGON);///MTC-C
    glColor3ub(0,78,225);
    glVertex2f((166-150)/150.0, - (96-150)/150.0);
    glVertex2f((169-150)/150.0, - (99-150)/150.0);
    glVertex2f((173-150)/150.0, - (97-150)/150.0);
    glVertex2f((176-150)/150.0, - (97-150)/150.0);
    glVertex2f((179-150)/150.0, - (99-150)/150.0);
    glVertex2f((180-150)/150.0, - (100-150)/150.0);
    glVertex2f((180-150)/150.0, - (103-150)/150.0);
    glVertex2f((184-150)/150.0, - (101-150)/150.0);
    glVertex2f((184-150)/150.0, - (96-150)/150.0);
    glVertex2f((181-150)/150.0, - (96-150)/150.0);
    glVertex2f((181-150)/150.0, - (97-150)/150.0);
    glVertex2f((178-150)/150.0, - (95-150)/150.0);
    glVertex2f((170-150)/150.0, - (95-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3ub(0,78,225);
    glVertex2f((163-150)/150.0, - (101-150)/150.0);
    glVertex2f((160-150)/150.0, - (104-150)/150.0);
    glVertex2f((160-150)/150.0, - (114-150)/150.0);
    glVertex2f((163-150)/150.0, - (113-150)/150.0);
    glVertex2f((165-150)/150.0, - (112-150)/150.0);
    glVertex2f((166-150)/150.0, - (112-150)/150.0);
    glVertex2f((172-150)/150.0, - (118-150)/150.0);
    glVertex2f((175-150)/150.0, - (120-150)/150.0);
    glVertex2f((180-150)/150.0, - (120-150)/150.0);
    glVertex2f((185-150)/150.0, - (117-150)/150.0);
    glVertex2f((182-150)/150.0, - (115-150)/150.0);
    glVertex2f((180-150)/150.0, - (115-150)/150.0);
    glVertex2f((179-150)/150.0, - (118-150)/150.0);
    glVertex2f((168-150)/150.0, - (108-150)/150.0);
    glEnd();
    glBegin(GL_POLYGON);
    glColor3f(0.0,0.0,0.0);
    glVertex2f((177-150)/150.0, - (117-150)/150.0);
    glVertex2f((179-150)/150.0, - (117-150)/150.0);
    glVertex2f((180-150)/150.0, - (101-150)/150.0);
    glVertex2f((177-150)/150.0, - (97-150)/150.0);
    glVertex2f((173-150)/150.0, - (97-150)/150.0);
    glVertex2f((170-150)/150.0, - (100-150)/150.0);
    glVertex2f((166-150)/150.0, - (104-150)/150.0);
    glVertex2f((166-150)/150.0, - (107-150)/150.0);
    glVertex2f((167-150)/150.0, - (109-150)/150.0);
    glEnd();

glutSwapBuffers();
}
void mouse(int botton,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("weeeeeeeeeeeeeek3!");
    glutDisplayFunc(display);
    glutMouseFunc(mouse);
    glutMainLoop();
}



沒有留言:

張貼留言