[IronPython] Direct3D IronPython Sample

drew moore drew at astro.pas.rochester.edu
Sat Sep 23 01:47:23 CEST 2006

Dave Fugate wrote:
> I believe you'll need the full SDK. If you try running the samples with only the DirectX runtime you'll see something similar to the following:
>    ipy.exe demo1.py
>    Traceback (most recent call last):
>      File E:\Ip\IronPython\Samples\Direct3D\demo1.py, line 17, in Initialize
>      File , line 0, in __import__##5
>      File E:\Ip\IronPython\Samples\Direct3D\framework.py, line 35, in Initialize
>    ImportError: Cannot import name Direct3D
I found I was able to get Direct3D to import without the full SDK by 
adding two more lines to framework.py:

clr.AddReferenceByPartialName("Microsoft.DirectX.Direct3D")  # this one
clr.AddReferenceByPartialName("Microsoft.DirectX.Direct3DX")  # and this one

I ran into other problems later... This might help someone else, or you 
might run into the same stuff I ran into.

The odd thing is that the third line did not allow me to do
from Microsoft.DirectX import Direct3DX
(which you might expect.)
But it DID seem to add new stuff to the Direct3D namespace instead. 
Apparently .NET reference names and IronPython module names don't need 
to agree... but many times they do. (???)

(I found this stuff while mucking around with IronPython and Raines' 
.NET bindings to Smith's Open Dynamics Engine.)


I mananged to convert a little bit of his sample C# code to IronPython. ;-)



More information about the Ironpython-users mailing list