gl劃線
glbegin(gl_lines);//start to draw something
glvertex3f(0.0f, 0.0f, -10.0f);
glvertex3f(-5.0f, 0.0f, -10.0f);
glvertex3f(-5.0f, 0.0f, -10.0f);
glvertex3f(-5.0f, -2.0f, -10.0f);
gl畫收尾相接的線
glbegin(gl_line_strip);//start to draw something
glvertex3f(0.0f, 0.0f, -10.f);
glvertex3f(-5.0, 0.0f, -10.f);
glvertex3f(-5.0f, -2.0f, -10.f);
gl畫線收尾相接的環
glbegin(gl_line_loop);//start to draw something
glvertex3f(0.0f, 0.0f, -10.f);
glvertex3f(-5.0, 0.0f, -10.f);
glvertex3f(-5.0f, -2.0f, -10.f);
彩帶,更改當前點的顏色 :漸變差值
glbegin(gl_line_loop);//start to draw something
glcolor4ub(255, 0, 0, 255);
glvertex3f(0.0f, 0.0f, -10.f);
glcolor4ub(0, 255, 0, 255);
glvertex3f(-5.0, 0.0f, -10.f);
glcolor4ub(0, 0, 255, 255);
glvertex3f(-5.0f, -2.0f, -10.f);
glend(); //end
gl畫三角形
glbegin(gl_********s);//start to draw something
glcolor4ub(255, 0, 0, 255);
glvertex3f(0.0f, 0.0f, -10.f);
glcolor4ub(0, 255, 0, 255);
glvertex3f(-5.0, 0.0f, -10.f);
glcolor4ub(0, 0, 255, 255);
glvertex3f(-5.0f, -2.0f, -10.f);
glend(); //end
glenable(gl_cull_face);//擦除正面->逆時針
glenable(gl_cull_face);//擦除背面 順時針背面, 逆時針正面 攝像機點如何連線的
//front face:cow :ccw-> counter clock wind
glfrontface(gl_cull_face);
//將順時針,逆時針互換
glbegin(gl_********s);//start to draw something
glcolor4ub(255, 0, 0, 255);
glvertex3f(0.0f, 0.0f, -10.f);
glcolor4ub(0, 0, 255, 255);
glvertex3f(-5.0f, -2.0f, -10.f);
glcolor4ub(0, 255, 0, 255);
glvertex3f(-5.0, 0.0f, -10.f);
glend(); //end
兩個三角形
glvertex3f(0.0f, 0.0f, -10.f);
glcolor4ub(0, 255, 0, 255);
glvertex3f(-5.0, 0.0f, -10.f);
glcolor4ub(0, 0, 255, 255);
glvertex3f(-5.0f, -2.0f, -10.f);
glcolor4ub(255, 0, 0, 255);
glvertex3f(0.0f, 0.0f, -10.f);
glcolor4ub(0, 255, 0, 255);
glvertex3f(5.0, 0.0f, -10.f);
glcolor4ub(0, 0, 255, 255);
glvertex3f(5.0f, -2.0f, -10.f);
glend(); //end
glbegin(gl_********_strip);//start to draw something
//遇到奇數點 -> n+1- >n+2 順序連線 遇到偶點 n+1->n->n+2畫n-2個三角形
glcolor4ub(255, 0, 0, 255);
glvertex3f(0.0f, 0.0f, -10.f);
glcolor4ub(0, 255, 0, 255);
glvertex3f(-5.0, 0.0f, -10.f);
glcolor4ub(0, 0, 255, 255);
glvertex3f(-5.0f, -2.0f, -10.f);
glcolor4ub(255, 0, 0, 255);
glvertex3f(5.0f, 0.0f, -10.f);
glcolor4ub(0, 255, 0, 255);
glvertex3f(0.0, 0.0f, -10.f);
glcolor4ub(0, 0, 255, 255);
glvertex3f(0.0f, -2.0f, -10.f);
三角形扇
glbegin(gl_********_fan);//start to draw something
glcolor4ub(255, 0, 0, 255);
glvertex3f(0.0f, 0.0f, -10.f);
glcolor4ub(0, 0, 255, 255);
glvertex3f(-5.0, -2.0f, -10.f);
glcolor4ub(0, 255, 0,255);
glvertex3f(-3.0f, -2.0f, -10.f);
glcolor4ub( 0, 0, 255,255);
glvertex3f(-1.0f, -2.0f, -10.f);
OpenGL畫三角形
修改paintgl函式 void nehewidget paintgl 清楚螢幕和深度快取 glclear gl color buffer bit gl depth buffer bit 重置當前的模型觀察矩陣 glloadidentity gltranslatef 1.5,0.0,6.0 開始繪製...
css border 畫三角形
前幾日在瀏覽 中無意發覺了人家用css來畫三角形,我覺得很有趣但不太會所以就問了一下師姐,發覺自己很無知,呵呵,原來很多人都是用這種方法畫三角形的,為什麼的,原因如下 1 一張小三角形的可能有幾百位元組,不過幾百位元組可以寫多少行 呢?2 太多會導致網頁載入得會很慢 先看 吧 html css bo...
css畫三角形
好久沒寫css了,練練手,剛看了下在以前公司做過的乙個 現在已經改版,裡面有個模組涉及到用css畫三角形,試著做了一下,分享出來。帳號 287019674 qq.com 密碼 123456 下面是對實現原理的分析 1 新建乙個元素,隨便什麼元素,不過我習慣性的會用塊元素來做。如果行內元素就displ...