[IronPython] Direct3D IronPython Sample

Nathan R. Ernst ernsnat at iit.edu
Sat Sep 23 03:03:21 CEST 2006

The odd thing is that the third line did not allow me to do
from Microsoft.DirectX import Direct3DX

Not being terribly familiar with the DirectX 3D libs (I've only tinkered
with the managed DirectSound wrappers), I would suggest the explanation is
that the third assembly uses the same namespace.  People often confuse
assembly name with namespace.  The two are tied together only by convention.

That having been said, IronPython of course imports types using the
namespace, the AddReference* calls are merely to load the assembly into the

I find it rude when library developers do not name assemblies the same as
their root namespace.

My guess would be that the Direct3D libs are split to keep rarely used
symbols out of the main library in order to reduce resource consumption.  A
nice token, but I find it to be a bit of an annoyance given its all in the
same namespace.

I'll get off my soapbox now.  I hope, though, that I might have been a tad
bit helpful.


-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of drew moore
Sent: Friday, September 22, 2006 6:47 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Direct3D IronPython Sample

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
>      File , line 0, in __import__##5
>      File E:\Ip\IronPython\Samples\Direct3D\framework.py, line 35, in
>    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. ;-)



users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list