我試圖用DrawRangeElements
函數繪製,但由於某些原因,它沒有繪製出一部分元素。DrawRangeElements沒有正確繪製
例如,我有156分。我的每個元素包含52個點(3個元素x 52點= 156點)。
考慮這樣的代碼:
//points contains 156 points
float[] points = new float[] {
1f, 2f, 3f, // 0
//......... //refers to first element
4f, 5f, 5f, //51
6f, 7f, 8f, //52
//......... //refers to second element
9f, 10f, 11f, //103
6f, 7f, 8f, //104
//......... //refers to third element
9f, 10f, 11f, //155
};
隨着DrawElements一切工作正常。
var indices1 = Enumerable.Range(0, 52).Select(i => (uint)i).ToArray();
var indices2 = Enumerable.Range(52, 52).Select(i => (uint)i).ToArray();
var indices3 = Enumerable.Range(104, 52).Select(i => (uint)i).ToArray();
GL.DrawElements(PrimitiveType.QuadStrip, 52, DrawElementsType.UnsignedInt, indices1);
GL.DrawElements(PrimitiveType.QuadStrip, 52, DrawElementsType.UnsignedInt, indices2);
GL.DrawElements(PrimitiveType.QuadStrip, 52, DrawElementsType.UnsignedInt, indices3);
但DrawRangeElements我effors失敗。三個元素中只有一個正在繪製。
var indices = Enumerable.Range(0, 156).Select(i => (uint)i).ToArray();
GL.DrawRangeElements(PrimitiveType.QuadStrip, 0, 51, 52, DrawElementsType.UnsignedInt, indices);
GL.DrawRangeElements(PrimitiveType.QuadStrip, 52, 103, 52, DrawElementsType.UnsignedInt, indices);
GL.DrawRangeElements(PrimitiveType.QuadStrip, 104, 155, 52, DrawElementsType.UnsignedInt, indices);
如何與DrawRangeElements
我可以畫我的3個元素?