第一課 OpenGL繪製直線等等

2021-06-03 07:36:39 字數 2436 閱讀 2429

//  main.c

//  opengl_ animationrect_0002

////  created by  ch_soft on 12-1-16.

//#include

#include

#include

#include

//用於繪製視窗需要的圖形

void renderscene()

//  2. 畫直線

//    glfloat sizesline[2];//儲存線寬的尺寸範圍

//    glfloat stepline;//儲存線寬度尺寸的最小間隔

glfloat cursizeline=5;

//    glgetfloatv(gl_line_width_range,sizesline);

//    glgetfloatv(gl_line_width_granularity,&stepline);

gllinewidth(cursizeline); 

glbegin

(gl_lines);

glvertex3f

(25.0f,160.0f,0.0f);

glvertex3f

(225.0f,160.0f,0.0f); 

glend();

//   3.畫連續的直線

glbegin

(gl_line_strip);

glvertex3f

(25.0f,150.0f,0.0f);

glvertex3f

(100.0f,150.0f,0.0f); 

glvertex3f

(100.0f,130.0f,0.0f);

glend();

glbegin

(gl_line_strip);

glvertex3f

(0.0f,0.0f,0.0f);

glvertex3f

(10.0f,10.0f,0.0f);

glvertex3f

(20.0f,5.0f,0.0f);

glend();

//   4.畫封閉式直線

glbegin

(gl_line_loop);

glvertex3f

(125.0f,150.0f,0.0f);

glvertex3f

(200.0f,150.0f,0.0f); 

glvertex3f

(200.0f,130.0f,0.0f);

glend();

//   畫虛線

glenable

(gl_line_stipple); 

gllinestipple(1

,0x00ff

);//第乙個引數是倍數,第二個引數是乙個十六進製制數,用來表示如何顯示的

glbegin

(gl_lines);

glvertex3f

(25.0f,120.0f,0.0f);

glvertex3f

(225.0f,120.0f,0.0f); 

glend();

gllinewidth(3);

gllinestipple(1,

0xff0c

); 

glbegin

(gl_lines);

glvertex3f

(25.0f,80.0f,0.0f);

glvertex3f

(225.0f,80.0f,0.0f);

glend();

gllinestipple(4,

0xff0c

); 

glbegin

(gl_lines);

glvertex3f

(25.0f,40.0f,0.0f);

glvertex3f

(225.0f,40.0f,0.0f); 

glend();

gldisable

(gl_line_stipple);

//重新整理opengl命令佇列

glflush();

}//改變大小時呼叫的函式

void changesize(glsizei w,glsizei h)

//設定視區尺寸

glviewport(0, 0, w, h);

//重置座標系統,使用投影變換復位

glmatrixmode

(gl_projection);

glloadidentity();

if (w<=h) else

glmatrixmode(

gl_modelview);

glloadidentity(); }

//用於初始化,常用來設定場景的渲染狀態

void setuprc(void)

int main(int argc,char** argv)

開學第一課

因為是開學第一課,而且這是我的第一篇個人部落格,更何況還是技術部落格,所以我會認真對待,不過畢竟第一次,所以難免各方面會有不足,所以有任何的意見或建議都可以提出來以供本人提高。下面廢話少說,進入正題。使用quartus,新建乙個專案,建立乙個bdf檔案,雙擊bdf空白處,新增元件符號。找到 7413...

鋼琴第一課

哇 昨天去上了第一節鋼琴課,好開心好開心 核心要義 感覺自己像個小公主 儀態儀容 屁股只能坐一半 身體保持正直 手非常溫柔非常輕鬆地搭到琴鍵上 胳膊肘整個過程保持不動 兩手手腕微微向內旋轉,盡量讓手背與琴鍵平行,中空狀。落下時,呈自由落體狀,每個手指放到該放的琴鍵上。一首曲目彈奏完畢,手,輕輕地溫柔...

第一課 變數

一 變數 一 變數命名 1 使用具有固定意義的英文單詞或縮寫,如srv server,skt socket 2 駝峰命名法 1 大駝峰 myfirstlove,intoone,用大駝峰給類命名 2 小駝峰 myfirstlove,intoone,其他變數和函式的命名 3 posix my first...