pangolin庫的簡單使用

2021-09-26 23:43:08 字數 1442 閱讀 1177

原文:

pangolin是opengl的輕量級封裝

**解釋均在注釋之中

#include 

int main

( int /*argc*/

, char**

/*ar***/);

//變換矩陣

glmultmatrixf

(twc.

data()

);//畫點

glpointsize

(10.0f)

;glbegin

(gl_points);

glcolor3f

(1.0

,1.0

,0.1);

glvertex3f(0

,0,0

);glend()

;//畫線,一對點代表一條線

const float w =5;

const float h = w*

0.75

;const float z = w*

0.6;

gllinewidth(2

);//線寬

glcolor3f

(1.0

,1.0,0

);glbegin

(gl_lines);

//第一條線,連線如下兩個點

glvertex3f(0

,0,0

);glvertex3f(1

,1,1

);//第二條線,連線如下兩個點

glvertex3f(5

,1,0.5);

glvertex3f

(w,-h,z)

;//以此類推...

glvertex3f(5

,2,5

);glvertex3f

(-w,

-h,z)

;glvertex3f(0

,0,0

);glvertex3f

(-w,h,z)

;glvertex3f

(w,h,z)

;glvertex3f

(-w,h,z)

;glvertex3f

(-w,h,z)

;glvertex3f

(-w,

-h,z)

;glvertex3f

(-w,

-h,z)

;glvertex3f

(w,-h,z)

;glvertex3f

(w,-h,z)

;glvertex3f

(w,h,z)

;glend()

;// swap frames and process events

pangolin:

:finishframe()

;}return0;

}

request庫的簡單使用

7種基本用法 首先安裝requests庫 如果你本地只有乙個python環境直接執行pip install requests 像我本地裝了3個不同的python怎麼使你安裝在你想要安裝的python下呢?我以安裝到python3.6為例 找到python的安裝位置下的scripts目錄複製 進入cm...

NumPy庫的簡單使用

numpython提供了兩種基本的物件 陣列的屬性及其說明 屬性說明 ndim 返回int。表示陣列的維數 shape 返回tuple。表示陣列的尺寸,對於n行m列的矩陣,形狀為 n,m size 返回int。表示陣列的元素總數,等於陣列形狀的乘積 dtype 返回data type。描述陣列中元素...

react color庫的簡單使用

npm i react color s import from react color 複製 然後在render 中使用即可 複製 定義乙個顏色狀態,用來儲存使用者選擇的顏色值 constructor props 複製 渲染成這樣 render 複製 預設效果,可以看到,當前選中的顏色值是 ffff...