我最近看了關於加快信息添加到頂點緩衝的過程中對Badlogicgames.com的文章(或任何其他intbuffer),它確實增加了我的項目的速度,但我不明白的將int數組插入到Android的OpenGL ES 1.0的intbuffer中?
「注意到了IntBuffer.put(INT [] SRC)並沒有受到影響的問題」
聲明....是否有可能養活一個int []數組爲IntBuffer獲得速度增加如果你不需要浮點數?每次我嘗試將int []放入緩衝區時,任何渲染...
這是我目前使用的例子:
現在,如果int數組「COORDS」是充滿了漂浮轉換爲使用「浮動整數點數字變量dMesh[i].putVertexBuffer(coords); //function being called
public void putVertexBuffer(int[] input) //actual function
{
ByteBuffer tC = ByteBuffer.allocateDirect(input.length *4);
tC.order(ByteOrder.nativeOrder());
_vertexBuffer = tC.asIntBuffer();
_vertexBuffer.put(input);
_vertexBuffer.position(0);
}
。 floatToIntBits(float value)「;這是好的......但一個標準整數數組並沒有顯示任何東西......但是,如果我只是有一個float []數組並將「asIntBuffer()」更改爲「asFloatBuffer()」,這是否有效?我很困惑。是否需要轉換? Thankyou提前給任何洞察力的人。
快速編輯: 我差點忘了...這是我引用的文章: http://www.badlogicgames.com/wiki/index.php/Direct_Bulk_FloatBuffer.put_is_slow
歡迎來到StackOverflow,我希望你閱讀[FAQ](http://stackoverflow.com/faq#howtoask)。 –