編輯:關於Android編程
1.四稜錐: 由4個三角形構成。
四方體: 由6個三角形構成。
難點:在構建3D空間的頂點坐標時,要讓對象繞自身的軸旋轉,必須讓對象的中心坐標總是(0.0f,0.0f,0.0f),
並且三角形都是按逆時針次序繪制的。
2.3D空間的繪制:
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
參數說明:
mode,繪制方式,OpenGL2.0以後提供以下參數:GL_POINTS、GL_LINES、GL_LINE_LOOP、GL_LINE_STRIP、GL_TRIANGLES、GL_TRIANGLE_STRIP、GL_TRIANGLE_FAN。
first,從數組緩存中的哪一位開始繪制,一般為0。
count,數組中頂點的數量。
3.繪制頂點數組:
//繪制三角錐
for(int i=0; i<4; i++)
{
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, i*3, 3);
}
//繪制四方體
for(int i=0; i<6; i++)
{
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, i*4, 4);
}
[附]構建頂點數組:
[java]
int one = 0x10000;
// 四稜錐頂點數組:
private IntBuffer triggerBuffer = IntBuffer.wrap(new int[]{
0,one,0,
-one,-one,0,
one,-one,one,
0,one,0,
one,-one,one,
one,-one,-one,
0,one,0,
one,-one,-one,
-one,-one,-one,
0,one,0,
-one,-one,-one,
-one,-one,one
});
// 四方體頂點數組:
private IntBuffer quaterBuffer = IntBuffer.wrap(new int[]{
one,one,-one,
-one,one,-one,
one,one,one,
-one,one,one,
one,-one,one,
-one,-one,one,
one,-one,-one,
-one,-one,-one,
one,one,one,
-one,one,one,
one,-one,one,
-one,-one,one,
one,-one,-one,
-one,-one,-one,
one,one,-one,
-one,one,-one,
-one,one,one,
-one,one,-one,
-one,-one,one,
-one,-one,-one,
one, one, -one,
one, one, one,
one, -one, -one,
one, -one, one,
});
int one = 0x10000;
// 四稜錐頂點數組:
private IntBuffer triggerBuffer = IntBuffer.wrap(new int[]{
0,one,0,
-one,-one,0,
one,-one,one,
0,one,0,
one,-one,one,
one,-one,-one,
0,one,0,
one,-one,-one,
-one,-one,-one,
0,one,0,
-one,-one,-one,
-one,-one,one
});
// 四方體頂點數組:
private IntBuffer quaterBuffer = IntBuffer.wrap(new int[]{
one,one,-one,
-one,one,-one,
one,one,one,
-one,one,one,
one,-one,one,
-one,-one,one,
one,-one,-one,
-one,-one,-one,
one,one,one,
-one,one,one,
one,-one,one,
-one,-one,one,
one,-one,-one,
-one,-one,-one,
one,one,-one,
-one,one,-one,
-one,one,one,
-one,one,-one,
-one,-one,one,
-one,-one,-one,
one, one, -one,
one, one, one,
one, -one, -one,
one, -one, one,
});
剛剛買回了手機,手機裡面或多或少都會帶有一些本身的系統軟件,有些軟件很少用,但是卻很占內存,想必很多人選擇ROOT的直接原因就是系統自帶軟件太多了,不僅占用
首先來看一下我實現的效果圖: 從”我的關注”開始,每一個條目都是一個自定義組合控件.下面,我來講解一下具體實現步驟: 一.根據
其實webview加載資源的速度並不慢,但是如果資源多了,當然就很慢。圖片、css 、js 、html這些資源每個大概需要10-200ms ,一般都是30ms就ok了。不
簡介最近因為項目需求,要實現一款雷達圖來表示用戶的各種成就值雷達圖的繪制很簡單,只要思路清晰按部就班的繪制就可以了,其中使用得最多,是路徑path類的使用,使用這個類可以