編輯:關於Android編程
引用一段網上的話:
For both, you pass OpenGL some buffers containing vertex data.
glDrawArrays is basically "draw this contiguous range of vertices, using the data I gave you earlier". Good:
You don't need to build an index buffer
Bad:
If you organise your data into GL_TRIANGLES, you will have duplicate vertex data for adjacent triangles. This is obviously wasteful.
If you use GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN to try and avoid duplicating data: it isn't terribly effective and you'd have to make a rendering call for each strip and fan. OpenGL calls are expensive and should be avoided where possible
With glDrawElements, you pass in buffer containing the indices of the vertices you want to draw.
Good
No duplicate vertex data - you just index the same data for different triangles
You can just use GL_TRIANGLES and rely on the vertex cache to avoid processing the same data twice - no need to re-organise your geometry data or split rendering over multiple calls
Bad
Memory overhead of index buffer
My recommendation is to use glDrawElements
個人理解為:
glDrawArrays主要講數據空間損耗在頂點的定義處;
glDrawElements主要講數據空間損耗在頂點索引的定義處;
如果在你的工程中,畫的圖形較少或者,圖形雖多但很多相同的,則可采用glDrawArrays更節省數據占用的空間;
相反,如果圖形多,而且形狀大不相同的時候,可以優先考慮采用glDrawElements函數。
(點擊上面的名稱,即可進入官方對此函數的說明)
一直都想親自做一次使用android應用程序訪問Linux內核驅動的嘗試,但總是沒能做到。最近抽出時間,下決心重新嘗試一次。嘗試的開始當然是先寫一個Linux內核驅動了。
前言、動畫分類 如下圖所示,Android的動畫主要分為三種: 動畫XML的代碼如下—— 對動畫xml的說明如下: a
隨著網絡購物的流行,我們經常要和不同的快遞公司打交道,大多數人都知道通過快遞單號可以在快遞公司網站上查詢快遞的狀態。但是如果自己不在電腦旁邊,是不是就查詢不
手機短信收發有三種方式:Block方式、Text方式和PDU方式,前兩種在國內很少使用,PDU格式則普遍支持。內容總長度140個字節(1120位),支持采用