Exemple #1
0
        protected VertexBuffer(
            GraphicsDevice graphicsDevice,
            VertexDeclaration vertexDeclaration,
            int vertexCount,
            BufferUsage bufferUsage,
            bool dynamic
            )
        {
            if (graphicsDevice == null)
            {
                throw new ArgumentNullException("graphicsDevice");
            }

            GraphicsDevice    = graphicsDevice;
            VertexDeclaration = vertexDeclaration;
            VertexCount       = vertexCount;
            BufferUsage       = bufferUsage;

            // Make sure the graphics device is assigned in the vertex declaration.
            if (vertexDeclaration.GraphicsDevice != graphicsDevice)
            {
                vertexDeclaration.GraphicsDevice = graphicsDevice;
            }

            buffer = FNA3D.FNA3D_GenVertexBuffer(
                GraphicsDevice.GLDevice,
                (byte)(dynamic ? 1 : 0),
                bufferUsage,
                VertexCount * VertexDeclaration.VertexStride
                );
        }
Exemple #2
0
        protected VertexBuffer(
            VertexDeclaration vertexDeclaration,
            int vertexCount,
            BufferUsage bufferUsage,
            bool dynamic
            )
        {
            GraphicsDevice    = GraphicsDeviceManager.Instance.GraphicsDevice;
            VertexDeclaration = vertexDeclaration;
            VertexCount       = vertexCount;
            BufferUsage       = bufferUsage;

            // Make sure the graphics device is assigned in the vertex declaration.
            if (vertexDeclaration.GraphicsDevice != GraphicsDevice)
            {
                vertexDeclaration.GraphicsDevice = GraphicsDevice;
            }

            buffer = FNA3D.FNA3D_GenVertexBuffer(
                GraphicsDevice.GLDevice,
                (byte)(dynamic ? 1 : 0),
                bufferUsage,
                VertexCount * VertexDeclaration.VertexStride
                );
        }