[IronPython] XNA and how to specify the type arguments explicitly

Richard Steventon steventon at gmail.com
Tue Feb 2 11:23:16 CET 2010


A newbie here.  I am trying to use the XNA infrastructure to render
some data, since all I need is points and colored triangles and a
movable camera.

Code snippet:
    def SetupVerticies(self):
        l = Array.CreateInstance(VertexPositionColor,6)
        l[0] = VertexPositionColor(Vector3(0., 0., 0.), Color.White)
        l[1] = VertexPositionColor(Vector3(5., 0., 0.), Color.White)
        l[2] = VertexPositionColor(Vector3(10., 0., 0.), Color.White)
        l[3] = VertexPositionColor(Vector3(5., 0., -5.), Color.White)
        l[4] = VertexPositionColor(Vector3(0., 0., 0.), Color.White)
        l[5] = VertexPositionColor(Vector3(10., 0., -5.), Color.White)
        self.vertices = l

    def CopyTerrainToGraphicsBuffers(self):
        self.VertexBuffer = VertexBuffer(self.graphics.GraphicsDevice, \
            len(self.vertices) * VertexPositionColor.SizeInBytes, \
            BufferUsage.WriteOnly)
        self.VertexBuffer.SetData(self.vertices)

This dies with:
TypeError: The type arguments for method 'SetData' cannot be inferred
from the usage. Try specifying the type arguments explicitly.


Any idea how to do this ?



More information about the Ironpython-users mailing list