3D Acceleration in VirtualBox Guests
Last spring, the world changed forever when VirtualBox implemented support for 3D acceleration in Windows and Linux guests. I have a tendency to be behind the curve on world-changing events, so I didn’t found time to play with this new feature until a few days ago. But what I found made me really happy. Read on for the details.
One of the most common complaints about Ubuntu is, “It doesn’t run application X, which I need for school/work/gambling.”
Sometimes, wine is the solution to these problems. I’d be reluctant, however, to rely on wine if I needed a Windows program to run flawlessly. Wine can do wonderful things, but it can also do weird, flaky and unpredictable things in many cases, which is not acceptable in a production environment.
In most other situations, running Windows in a virtualized environment via any of a number of Linux virtualization platforms–VMware, VirtualBox, KVM, Xen, etc.–is the next-best way to get that tricky Windows-only application working on Ubuntu.
Until recently, however, the big caveat for virtualization in Linux was that applications requiring video hardware acceleration–which means most games made in the last decade, among other things–were not supported. In certain cases, some clever hackery could work around this limitation, and certain of VMware’s products boasted ostensible support for hardware acceleration in guests. But for most Linux users, and probably all non-geeks, running 3D applications in a Windows guest on Ubuntu remained out of the question.
That all changed last spring, however, when VirtualBox, my favorite virtualization application, implemented support for hardware acceleration in Windows and Linux guests, by providing direct access to the host’s video device. With that announcement, the holy grail of virtualization–at least from the ex-Windows gamer’s perspective–was realized.
Testing 3D acceleration
I was impressed with how easy it was to enable video acceleration in my Windows XP and Ubuntu virtual machines. Just click a checkbox under the “Display” section of the virtual machine’s configuration and you’re good to go (guest additions and, for Windows guests, WineD3D should also be installed).
After that, 3D applications will “just work.” As proof, here’s a screenshot of Tux Racer running in a Windows guest:
Granted, video acceleration in my Windows and Ubuntu guests wasn’t flawless. Graphics weren’t as smooth as they are on the host, and mouse movement was very erratic in several of the 3D applications I ran in Windows.
On the other hand, the fact that my Intel video hardware is relatively weak probably bears at least part of the responsibility for the choppy graphics, and the flaky mouse behavior could be due to any number of factors that may or may not have to do with 3D acceleration or the specifics of my hardware configuration.
In any case, 3D applications were certainly usable, even if they didn’t perform flawlessly, in my virtual machines. This is a huge improvement over the past, when using Ubuntu meant saying goodbye to a range of Windows-only applications that require hardware acceleration.
Ideally, the day will come when I can run every application I want natively on Ubuntu. But until then, user-friendly and feature-rich virtualization platforms like VirtualBox will remain a vitally important component of the Linux world.
Can it handle DirectX apps too? I though it can only emulate opengl calls. (That’s why the wineD3D is needed, becouse that’s not the “real” Direct X.)
How can you be an “ex-Windows gamer” if you’re playing a game in Windows? You’re still running a copy of Windows, even if virtualized. You’re either pirating it or paying for it, in which case you might as well just pirate it or pay for it and run it as your sole OS.
This post describes some things that Windows provides that Ubuntu doesn’t. What does Ubuntu provide that Windows doesn’t?
Seems like a better idea would be to run Windows for your main OS, to benefit from its stability and reliability, and run Ubuntu under Virtualbox if you need it for development or something.
CruelAngel: yes, it can handle DirectX apps, but through wineD3D. In other words you’re right that it can’t deal with DirectX calls directly, but if you install wineD3D, you can run DirectX applications (although I’ve read a lot of people saying it doesn’t always worked perfectly).
Disappointed: it sounds like you’re trolling, but for a quick and non-exhaustive list of things Ubuntu does and Windows doesn’t, I’d point you to a post a wrote a couple weeks ago: http://www.workswithu.com/2010/01/14/five-essential-ubuntu-features/ You seem to assume that most people only use Ubuntu because they either need it for development or don’t have access to Windows (because they can’t afford it and are unwilling to pirate it). That’s definitely not the case for me, and probably not for the vast majority of Ubuntu users either.
Hmm, it seems like XP (NT5) is the magic quantity for most VB users doing this. However, I don’t have a key for it anymore, and so I tried with 98SE (http://techswrite.wordpress.com/2010/01/20/wrestling-with-virtualbox/ for the long version of the story), which is not officially supported. I got mixed results and wasn’t patient enough for the few times installation was going through.
Ironically, I migrated to Ubuntu and then Linux Mint because I knew my time with XP was limited; losing keys, my installation disc was pressed before any of the Service Packs were released (and so reinstallation is ALWAYS a security risk)– I’m ready for more things to be native, too.
And as far as avoiding software piracy: yes, it was a factor initially, but there are many more reasons why I’ve stayed with the Debian branch of distros.
[…] 3D Acceleration in VirtualBox Guests In any case, 3D applications were certainly usable, even if they didn’t perform flawlessly, in my virtual machines. This is a huge improvement over the past, when using Ubuntu meant saying goodbye to a range of Windows-only applications that require hardware acceleration. […]
so if i wanted to install a directx game (max payne, for example) i’d just install D3D in ubuntu and then install the game on the windows VM and play?
Daniel: right. In fact, there are some screenshots of Max Payne running in VirtualBox at http://www.dedoimedo.com/computers/virtualbox-3-directx.html
Also, to be clear, you install wineD3D in VirtualBox, not in Ubuntu–there’s an option under one of the menus in the guest machine’s window where you can choose to install wineD3D. It will download it and mount it on the virtual CD drive; then you just open up Windows Explorer in the guest machine, navigate to your CD directory and run the wineD3D installer.
So what would be interesting is to repeat this test with a more powerfull graphics adapter, e.g. a recent nVidia card. I wonder how well a game like Half-Life 2 (or, if we’re going to push this to it’s limits – COD Modern Warfare 2?!) would run using WineD3D in VirtualBox.
Anyone care to test this?
Disappointed said, “Seems like a better idea would be to run Windows for your main OS, to benefit from its stability and reliability”…
HUH??
Not baked yet. I have 3D accel running on VB, which I’ve used on Ubuntu host/XP guest for years. Some things work, some don’t. In particular, can’t get Google Sketchup to run worth a dang with HW accel. Whereas it runs pretty well on Wine.
I’ve often noticed that when VB introduces a new feature it doesn’t really work quite right until the next rev. or two. This happened with USB 2.0, multi-processor, etc etc. But yeah, a really well done 3D accel would be pretty awesome.
the GNU userland !
Virtually every pc came with windows. By running linux with VB windows guest, u are not pirating, u are using d same windows u paid for. Windows offer me nothing than security risks and bondage. It dictates to u.
hi
Did you think Bush#39;s and the Republicans pro-business lack of oversight ended when Bush left ?
Buy
First, if You do write an article about 3D accel, get first the proper videocard to do a good test.
Secondly. A game should be running on all platforms, not only those who do provide DirectX. Same with drivers for hardware. Anno 2011, all games should be OpenGL as drivers should be opensource too. DirectX should be complete opensource.
I love this game and your site is pretty cool too, I book marked it. Keep on posting! thank -Ben