Tutorials build but will not run

I figured I would give DirectX programming a try since I've been finding myself frustrated with the old school ways of OpenGL. I downloaded the October SDK and installed it, I am using Visual Studio 2003 Professional on a Windows XP Professional operating system. This is running inside a VMWare machine.

I can run the example executables just fine, albeit in software mode, but it does work. Now for some reason when I load the tutorial 01 solution (createdevice) and attempt to run it I get the message 'Could not initialize Direct3D...'. I changed the exception handler in InitializeGraphics() function to output the message exception and it just gives me 'Error in the application'.

I have no idea what's going on here, the correct versions are set for the DirectX and Direct3D references.

Does anybody have any idea what might be going on here? Any help would be greatly appreciated.

Thanks,

[913 byte] By [WallyLawless] at [2008-2-25]
# 1
I have to admit to not being entirely clued-up on the whole VMWare thing - but is that a VirtualPC type thing?
If so, A lot of those tend to disable hardware acceleration - meaning that hardware acceleration Direct3D is most likely disabled. Thus you get your problem Smile
Any chance of running it outside of VMWare?
hth
Jack
JackHoxley at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 2
The tutorials REQUIRE hardware acceleration:

device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams); //Create a device

(This is the managed tutorial - but C++ will have similar code).

Change the DeviceType.Hardware to DeviceType.Ref to use the reference (in software) rasterizer. It will be slow!

The samples (as opposed to tutorials) check for hardware first and automatically switch to ref if its not there.

You won't get far inside VMWare or VPC - I would assume OpenGL has the same speed problem though.

TheZMan at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 3
You would have to use the reference rasterizer, which renders entirely in software and very slowly. As Andy mentioned, change that value in CreateDevice.

Suffice to say that any graphics API's performance is highly dependent on access to the graphics hardware resources. VMWare/Virtual PC are highly inappropriate environments for graphics programming.

DavidWeller at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 4
Thanks for the info, the DeviceType.Reference did the trick. I knew it would be slow running inside a virtual machine, you'd be surprised how well some OpenGL stuff runs inside VMware though. The latest version (5) supports Direct3D acceleration but looks like it's not quite there yet.....

The only reason I'm using VMWare is because it's the only way I was allowed to install the DirectX SDK on my PC at work since it's not a standard part of the software install (yet). Not sure if this is a separate issue or not, but my plan was to just copy the built exe from the virtual machine to my physical machine when it's too complicated to run virtually, is there anything I need to know when moving a DirectX app in this way? I know I would change the DeviceType back to hardware, but is there anything else?

Thanks again,

WallyLawless at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 5

my plan was to just copy the built exe from the virtual machine to my physical machine when it's too complicated to run virtually, is there anything I need to know when moving a DirectX app in this way? I know I would change the DeviceType back to hardware, but is there anything else?

It shouldn't be too complicated. A few things to check though:

1. The target machine will need the appropriate runtime/driver installed
2. If you're using D3DX then you may need to distribute the developer runtime (although, I'm not sure this is applicable to MDX programming!?)
3. Make sure you're enumerating all features you rely on.

That last point is a good place to slip-up when you've been developing with the REFRAST - because it supports pretty much everything, it's unlikely your application would ever have failed due to a non-existant hardware feature. However, when running on real hardware this can be quite common Smile

Jack

JackHoxley at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 6
Interesting to read that VMware support acceleration so I did some digging.

http://www.vmware.com/support/ws5/doc/ws_vidsound_d3d_limitations.html

Its *very* limited - only DX8 and DX8 feature in DX9.

TheZMan at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 7
Dude! Don't you work at Microsoft? I'm pretty sure I just saw you in a Channel9 video today. I forget which one it was though, saw far too many today.
WallyLawless at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 8

I used to http://www.thezbuffer.com/articles/241.aspx.

I was in the video by special invitation from the coding4fun guys.

TheZMan at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...