Beispiel #1
0
        protected override void CreateVertexBinding()
        {
            RemoveAndDispose(ref indexBuffer);

            Vertex[] vertices;
            int[]    indices;
            GeometricPrimitives.GenerateSphere(out vertices, out indices, Color.Gray);

            var device = DeviceManager.Direct3DDevice;

            buffer_        = ToDispose(Buffer.Create(device, BindFlags.VertexBuffer, vertices));
            vertexBinding_ = new VertexBufferBinding(buffer_, Utilities.SizeOf <Vertex>(), 0);

            indexBuffer    = ToDispose(Buffer.Create(device, BindFlags.IndexBuffer, indices));
            PrimitiveCount = indices.Length;
        }
Beispiel #2
0
        protected override void CreateDeviceDependentResources()
        {
            RemoveAndDispose(ref vertexBuffer);
            RemoveAndDispose(ref indexBuffer);

            // Retrieve our SharpDX.Direct3D11.Device1 instance
            var device = this.DeviceManager.Direct3DDevice;

            Vertex[] vertices;
            int[]    indices;
            GeometricPrimitives.GenerateSphere(out vertices, out indices, Color.Gray);

            vertexBuffer  = ToDispose(Buffer.Create(device, BindFlags.VertexBuffer, vertices));
            vertexBinding = new VertexBufferBinding(vertexBuffer, Utilities.SizeOf <Vertex>(), 0);

            indexBuffer      = ToDispose(Buffer.Create(device, BindFlags.IndexBuffer, indices));
            totalVertexCount = indices.Length;
        }