VirtualBox… Since somes days, the web is flooded with news about the new major version of VirtualBox (3.0 beta). And until yesterday I didn’t know this software.
VirtualBox is a virtual machine like the famous VMware or VirtualPC (although VirtualPC seems to be limited to run different Windows versions in Windows). VirtualBox is a virtualization technology for x86 hardware. What does it mean? With VirtualBox, you can run unmodified operating systems (including all softwares installed on these operating systems) directly on top of your existing operating system, in a special environment called a virtual machine. Your physical computer is called the host, while the virtual machine is called the guest. Ok that’s enough for the theory.
Wait a minute… why did I decide to test VirtualBox? Because all news claimed VirtualBox 3.0 BETA has now an improved… OpenGL support. More exactly, VirtualBox 3.0 supports OpenGL 2.0 and Direct3D 8.
Here are the main features of VirtualBox 3.0:
– Guest SMP with up to 32 virtual CPUs (VT-x and AMD-V only)
– Windows guests: ability to use Direct3D 8/9 applications / games (experimental)
– Support for OpenGL 2.0 for Windows, Linux and Solaris guests
To understand what VirtualBox 3.0 brings in OpenGL, I started my experimentations with the previous stable release: VirtualBox 2.2.4.
My host machine is an AMD X2 3800+ / 2Gb RAM / GeForce GTX 280 + ForceWare 190.15 / Windows XP SP2 32-bit.
What I wanted to see is how GPU Caps Viewer works in the virtual machine. Because in a virtual machine, there is no real hardware and the graphics card is virtualized. That’s the important point. Even if you have the latest Radeon or GeForce monster in the host, a 3D application running in the guest won’t see it.
So the first things I did were: 1/ install VirtualBox 2.2.4 on my host (Windows XP SP2 32-bit) 2/ create a virtual hard disk (20Gb – it’s an image file on host’s hard disk) and install on this disk Windows Vista Ultimate 32-bit 3/ install the Guest Additions (guest additions provide closer integration between host and guest and improve the interactive performance of guest systems – better mouse integration and above all better graphics card support) and 4/ fire up GPU Caps Viewer:
wooowww!!… OpenGL 1.1! VirtualBox is stronger than you!
After some searches, I found that the 3D support is disabled by default. 3D acceleration support can be enabled in VirtualBox settings:
GPU Caps Viewer please:
Ah… it’s better. But in the same time, this is the limitation of VirtualBox 2.x.x: OpenGL 1.5.
Did you notice the renderer name Chromium? Chromium is the virtual OpenGL renderer of VirtualBox.
Okay now I can download the beta of VirtualBox 3.0.
The cool thing with VirtualBox is that it installs a fully working virtual network adapter so you can directly surf the web at the first start of the guest.
Once installed, VirtualBox 3.0 found the virtual hard disk created by VirtualBox 2.2.4:
Before starting GPU Caps Viewer, one has to install also the Guest Additions that come with VirtualBox 3.0.
This time, GPU Caps Viewer has detected an OpenGL 2.0 graphics card with 66 extensions.
Just for the fun, let’s look at what GPU-Z displays:
Humm… GPU-Z does not like virtual graphics cards!
Okay, all theses tests are cool, but how an OpenGL application works in VirtualBox 3.0? How an OpenGL 2.0 (with some GLSL shaders) demo runs?
I tried to launch GPU Caps Viewer demos but without success. So I coded a small OpenGL demo with the same 3D engine than GPU Caps Viewer demos. This demo displays a simple textured mesh torus. This demo is available in two flavors:
– VBO + Phong GLSL shader
– no VBO + fixed pipeline for texturing/lighting (OpenGL 1.2)
Both versions worked fine in VirtualBox 3.0. The following screenshots show the VBO + GLSL shader version of the demo:
I wasn’t able to see if VBO worked correctly (there wasn’t speed improvement between non-VBO and VBO versions) but I can tell you that GLSL shaders are ok (look at the specular highlights)!
But ouch! The FPS is very low: 47.
The same demo running directly on the host gives about 2200 FPS:
Seems as if the virtual graphics card performs some 3D rendering in software mode… But RivaTuner monitoring (launched in the host) showed me that OpenGL acceleration was enabled.
There are some huge performance issues in VBO management and currently a better way to render meshes is to use OpenGL display lists (thanks to Leonid). The demo pack has been updated with a new demo called Mesh-DisplayList-PhongShader.exe. This new version runs at 60 FPS in the Vista32 guest.
Why GPU Caps Viewer demos didn’t work? I don’t know. Maybe a problem with multithreading. The previous textured mesh torus demo worked correctly in VirtualBox because it has only one thread. Each GPU Caps Viewer demo runs in its own thread and perhaps there is somewhere, in VirtualBox or in my multithreading code, a problem with OpenGL rendering contexts and threads.
You can download the OpenGL demos here:
I also quickly tested the Direct3D side of VirtualBox. I successfully ran one of my old Direct3D 8 demos (coded in 2002):
And DX9 demos? Not really supported (Could not find any compatible Direct3D devices.) …
VirtualBox is a nice piece of software and virtualization is a captivating technology because, in a word, virtual machines creators have to recode all hardware aspects of real machines. This is an incredible task! And when the virtual machine has to virtualize the graphics system to provide latest OpenGL and Direct3D support this is just insane (even if, thanks to guest additions, a guest OS has more access to the graphics hardware)! Anyway, VirtualBox 3.0 starts to support OpenGL 2.0 applications and it’s cool. When the low frame rate problem will be solved, that will allows to code OpenGL applications for a particular host (in my case Windows XP) and execute them on other hosts (Linux for example) thank to VirtualBox. And once my multithreading problem will be solved too, I will be able to quickly test my 3D applications in a Vista guest while I code on a XP host. I can’t wait a new VirtualBox update…
- VirtualBox homepage
- VirtualBox 3.0 BETA DOWNLOAD
- VirtualBox Forums
- VirtualBox @ Wikipedia
- VirtualBox @ Twitter
- VirtualBox 3.0 Beta Adds Gaming-Level Graphics
8 thoughts on “Quick Test: VirtualBox 3.0 and OpenGL 2.0”
Very neat software. I would like to know more!
Not sure I will get around to using it, but I definitely see the usefulness.
If you’d change torus demo to render torus geometry via an opengl display list it would give a huge (~30-40 times) fps increase.
glGenLists, glNewList…Send vetices..glEndList, and later glCallList when needed.
There’re some huge performance issues related to vertext processing in VBox code yet.
Hi Leonid and thanks for the tip.
I just tested it and it’s true: now the torus demo (with GLSL Phong shader) runs at 60 FPS (I didn’t find the way to disable vsync in virtualbox). I update the demo pack.
I have played with the vb as I have become a linux fan and migrated away from supporting anti-piracy. I think the reason your seeing lag issues is that programs like vb are running off the main hosts programming and not true independent o’s’s. so windows just registers this as running another application rather than an independent os. This is something the hyperthreaded pentium 4’s should and would take care of that the goverment unfortanetly pannicked and banned do to encryption concerns. :p. multitasking was entirely the right way to go with speed computing.
Government banned hypervising? Ha. That’s a good one. Neuromancer, it’s July, not April 1st. Ask anyone that uses Xen if the government has “banned” them.
WOw I just installed this on my Mac mini 2009 and run WinXP on it as a guest. So far so good!
Now to code and check out the OpenGL support… So the OpenGL driver for VB comes from Sun and not Nvidia or ATI? or it uses the hosts driver’s capabilities?
Pingback: [TEST] VirtualBox 3.1.4 OpenGL Quick Test - 3D Tech News, Pixel Hacking, Data Visualization and 3D Programming - Geeks3D.com
Pingback: VirtualBox 3.2.8 Available - 3D Tech News, Pixel Hacking, Data Visualization and 3D Programming - Geeks3D.com
Comments are closed.