예제 #1
0
        CSharpGL.Objects.VertexBuffers.BufferRenderer IModel.GetIndexes()
        {
            using (var indexBuffer = new IndexBuffer <uint>(DrawMode.TriangleStrip, IndexElementType.UnsignedInt, BufferUsage.StaticDraw))
            {
                indexBuffer.Alloc(indexes.Length);
                unsafe
                {
                    uint *indexArray = (uint *)indexBuffer.FirstElement();
                    for (int i = 0; i < indexes.Length; i++)
                    {
                        indexArray[i] = indexes[i];
                    }
                }

                return(indexBuffer.GetRenderer());
            }
        }
예제 #2
0
        CSharpGL.Objects.VertexBuffers.IndexBufferPointerBase IModel.GetIndexes()
        {
            using (var buffer = new IndexBuffer <uint>(DrawMode.Triangles, IndexElementType.UnsignedInt, BufferUsage.StaticDraw))
            {
                buffer.Alloc(model.faceList.Count * 3);
                unsafe
                {
                    uint *array = (uint *)buffer.FirstElement();
                    for (int i = 0; i < model.faceList.Count; i++)
                    {
                        array[i * 3 + 0] = (uint)(model.faceList[i].Item1 - 1);
                        array[i * 3 + 1] = (uint)(model.faceList[i].Item2 - 1);
                        array[i * 3 + 2] = (uint)(model.faceList[i].Item3 - 1);
                    }
                }

                return(buffer.GetRenderer() as IndexBufferPointerBase);
            }
        }
예제 #3
0
        CSharpGL.Objects.VertexBuffers.IndexBufferPointerBase IModel.GetIndexes()
        {
            //using (var indexBuffer = new ZeroIndexBuffer(DrawMode.Quads, 0, 4 * 6))
            //{
            //    //indexBuffer.Alloc(0);

            //    return indexBuffer.GetRenderer() as ZeroIndexBufferRenderer;
            //}
            using (var buffer = new IndexBuffer <uint>(DrawMode.Triangles, IndexElementType.UnsignedInt, BufferUsage.StaticDraw))
            {
                buffer.Alloc(this.index.Length);
                unsafe
                {
                    uint *array = (uint *)buffer.FirstElement();
                    for (int i = 0; i < this.index.Length; i++)
                    {
                        array[i] = this.index[i];
                    }
                }

                return(buffer.GetRenderer() as IndexBufferPointerBase);
            }
        }