Video Of Working Windows DirectX Games in VirtualBox 3.0.2 on Ubuntu 9.0.4
I’ve spent too much time the last few weeks figuring out how to enable Direct3D hardware pass through in VirtualBox version 3.0.2, and then testing how well some of my games work in a virtual machine (VM). Check the end of this post for a 3 minute video I put together showing some of my results. The video is a sequence of desktop captures. What you are watching is my entire Ubuntu Jaunty desktop with the VirtualBox console open in the center. The games are being played full screen inside the VirtualBox VM. I did not record the actual game sound because I could not figure out how to do it with gtk-recordmydesktop (kept getting an error when sound capture was enabled). So, I created a my own mix of several popular songs for the video sound track instead.
Long story short, the only acceptable configuration I was able to achieve was on a 32 bit Ubuntu Jaunty host with a 32 bit Windows XP guest. My Ubuntu host does not even have virtualization assist technology in the processor – go figure! I first tried 32 bit Vista and Windows 7 RC VMs on a 64 bit Ubuntu host with Intel VT, but had no luck. [side note: Windows 7 is not advertised as supported for VirtualBox Direct3d yet anyways]
I had read a lot of forum threads and blog posts recently about how disappointed those who have tried already were, but, after the first couple of attempts I am quite pleased with my game(s) performance in a Windows XP VM. Not all of my games worked for various different reasons, but with a little research and some tweaks for everything from video performance to compatibility mode settings I got a handful of them to run. On the games that did not work, I left them installed. I’ll use VirtualBox’s OVF export feature to move this VM between different operating systems and PC hardware in the future hopefully for different results.
My Youtube video is embedded at the end of this post, but first here are some notes on my setup and about my efforts.
My Ubuntu host details


The XP VM details

Key Instructions on enabling DirectX support in VirtualBox
Found in section 4.8 of the Sun VirtualBox User Manual Version 3.0.2
“4.8 Hardware 3D acceleration (OpenGL and DirectX 8/9)
The VirtualBox Guest Additions contain experimental hardware 3D support for Windows, Linux and Solaris guests.
With this feature, if an application inside your virtual machine uses 3D features through the OpenGL or DirectX 8/9 programming interfaces, instead of emulating them in software (which would be slow), VirtualBox will attempt to use your host’s 3D hardware. This works for all supported host platforms (Windows, Mac, Linux, Solaris), provided that your host operating system can make use of your accelerated 3D hardware in the first place.
The 3D acceleration currently has the following preconditions:
1. It is only available for certain Windows, Linux and Solaris guests. In particular:
- For Windows guests, support is restricted to 32-bit versions of XP and Vista. Both OpenGL and DirectX 8/9 are supported (experimental).
- OpenGL on Linux requires kernel 2.6.27 and higher as well as X.org server version 1.5 and higher. Ubuntu 8.10 and Fedora 10 have been tested and confirmed as working.
- OpenGL on Solaris guests requires X.org server version 1.5 and higher.
2. The Guest Additions must be installed.
- Note: For Direct 3D acceleration to work in a Windows Guest, VirtualBox needs to replace Windows system files in the virtual machine. As a result, the Guest Additions installation program offers Direct 3D acceleration as an option that must be explicitly enabled. Also, you must install the Guest Additions in “Safe Mode”; see chapter 13, Known limitations, page 213 for details.
3. Because 3D support is still experimental at this time, it is disabled by default and must be manually enabled in the VM settings (see chapter 3.7.1, General settings, page 46)
Technically, VirtualBox implements this by installing an additional hardware 3D driver inside your guest when the Guest Additions are installed. This driver acts as a hardware 3D driver and reports to the guest operating system that the (virtual) hardware is capable of 3D hardware acceleration. When an application in the guest then requests hardware acceleration through the OpenGL or Direct3D programming interfaces, these are sent to the host through a special communication tunnel implemented by VirtualBox, and then the host performs the requested 3D operation via the host’s programming interfaces.”
“13 Known limitations
Direct 3D support in Windows guests. For this to work, the Guest Additions must be installed in Windows “safe mode”. Press F8 when the Windows guest is booting and select “Safe mode”, then install the Guest Additions. Otherwise Windows’ file protection mechanism will interfere with the replacement DLLs installed by VirtualBox and keep restoring the original Windows system DLLs.”
While installing the GuestAdditions in Safe Mode be sure to check the Direct3d option in the installation wizard options.
Getting the sound to work in my WinXP VM.
I ended up having to modify the pulseaudio config of 64 bit Ubuntu, and also install the Realtek audio drivers in the VM (in both 32 bit and 64 bit Ubuntu – the VirtualBox sound drivers did not work in the XP VM) as explained in both Virtualbox and Ubuntu forums. As I mentioned earlier, I did not get the games working in either the Vista or Windows 7 RC VM. I never tried Vista on the 32 bit Ubuntu desktop, however.
Desktop video captures of working games!
As I mentioned before, I did not record sound in any of the game sequences. Rest assured the sound worked in all of the games. There was a small amount of latency introduced by the desktop capture program (gtk-recordmydesktop) and I was only recording at 15 fps. Video resolution has been degraded by the editing and upload process too. Considering those conditions, gameplay is actually much better than shown in these videos. Here’s some general comments on playing each game.
Rise of Nations
I had some trouble using the mouse for item selection during the game. Hitting Rght Ctrl + F and playing in full screen mode is much better.
Hotwheels Velocity X
I was able to use my USB Logitech gamepad during this game (and a few others not mentioned). I did not even check the gamepad config in Ubuntu (problems for me in past versions). I just plugged it in my PC’s front USB port and after a few seconds it was an available device to connect to my VM. Windows XP found it right away
Spiderman The Movie
Since the gameplay relies on the mouse for directional changes, I experienced problems controlling Peter Parker as my mouse moved out of the VirtualBox console window often as I made sweeping guestures. To solve this I disabled the mouse grab feature so that the only way my mouse could leave the console was to hit the host key (rght ctrl)
Quake 3
Like Spiderman I had to disable the guest additions mouse grab feature to keep the mouse inside the VirtualBox console during the game.
Enjoy the video and the music mix. Let me know if you’ve got other game titles working in the comments!
Related Posts
-
mitcoes
-
rbrambley
-
Michael
-
aL
-
rbrambley
-
Igor
-
Srinivas
-
Srinivas
-
Srinivas
-
rbrambley










