On 02/02/2010 10:23, Richard Steventon wrote:
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 ?
Try this:
self.VertexBuffer.SetData[Array[VertexPositionColor]](self.vertices)
Michael
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
READ CAREFULLY. By accepting and reading this email you agree, on behalf of
your employer, to release me from all obligations and waivers arising from any
and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap,
clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and
acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your
employer, its partners, licensors, agents and assigns, in perpetuity, without
prejudice to my ongoing rights and privileges. You further represent that you
have the authority to release me from any BOGUS AGREEMENTS on behalf of your
employer.
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com