GLFW and VirtualBox?

honestguvnor wrote on Monday, March 05, 2012:

What is the expected behaviour of GLFW running under VirtualBox?

elmindreda wrote on Tuesday, March 06, 2012:

Which version of GLFW on which version of which client OS running on which
version of VirtualBox on which version of which host OS?

honestguvnor wrote on Tuesday, March 06, 2012:

GLFW header version: 2.7.3
GLFW library version: 2.7.3
OpenGL context version string: "2.1 Chromium 1.9"
OpenGL context version parsed by GLFW: 2.1.0
OpenGL context renderer string: "Chromium"
OpenGL context vendor string: "Humper"
OpenGL context shading language version: "4.00"
VirtualBox 4.1.8, Windows 7 Pro x86_64 host, SceintficLinux(RHEL) 6.2 guest
(with opengl patch)

I take if from your response that you would expect it to work?

The first problem I had was this one:

https://www.virtualbox.org/ticket/8329

which I “fixed” by stopping GLFW bailing out. Some of the examples and tests
work and some do not. Presumably some fail because of the version of OpenGL?
The reopen test does not work properly. Sometimes in full screen mode the
guest becomes unresponsive and has to be killed, sometimes it draws a
revolving plate but window size rather than full screen. Misbehaviour appears
similar to that reported by thoughton in the post below.

Opengl under virtualization is often a bit flaky and does not seem to get much
attention and so I asked if GLFW was expected to work.

PS. Tried Ubuntu 10.04 guest with the same result: needed to edit glfw to get
a window and the test reopen caused the guest to become unresponsive after
showing a window sized revolving plate in fullscreen. I think it became
unresponsive when it tried to switch back to a window from full screen.

elmindreda wrote on Tuesday, March 06, 2012:

I mostly use VirtualBox with Ubuntu and GeForce w/ binary blob as host and
Windows XP as guest. This works well enough that I use it for GLFW
development. I haven’t used Linux as guest that much, but I will try it and
get back to you. There may be something that can be done.

elmindreda wrote on Wednesday, March 07, 2012:

I tried with Ubuntu 11.10 accelerated Unity guest on my Ubuntu 11.04 host.

I had to take out the GLX_WINDOW_BIT test for glfwOpenWindow to run, same as
you, but have not been able to reproduce the problems with fullscreen windows.
I did encounter similar problems in windowed mode after running the reopen
test for a minute.

The backtrace I got was this (the window size differs because of a local
edit):

#0  0x00130416 in __kernel_vsyscall ()
#1  0x002da619 in __lll_lock_wait () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x002d5f8b in _L_lock_786 () from /lib/i386-linux-gnu/libpthread.so.0
#3  0x002d5e45 in pthread_mutex_lock ()
   from /lib/i386-linux-gnu/libpthread.so.0
#4  0x005d363c in crLockMutex () from /usr/lib/VBoxOGLcrutil.so
#5  0x005117ec in stubMakeCurrent ()
   from /usr/lib/i386-linux-gnu/dri/vboxvideo_dri.so
#6  0x00526c54 in vboxstub_glXMakeCurrent ()
   from /usr/lib/i386-linux-gnu/dri/vboxvideo_dri.so
#7  0x00529e4a in vbox_glXMakeCurrent ()
   from /usr/lib/i386-linux-gnu/dri/vboxvideo_dri.so
#8  0x0804e667 in _glfwPlatformOpenWindow (width=800, height=600, 
    wndconfig=0xbffff150, fbconfig=0xbffff118) at x11_window.c:1469
#9  0x0804b16c in glfwOpenWindow (width=800, height=600, redbits=0, 
    greenbits=0, bluebits=0, alphabits=0, depthbits=16, stencilbits=0, 
    mode=65537) at ../window.c:547
#10 0x0804a085 in open_window (width=800, height=600, mode=65537)
    at reopen.c:86
#11 0x0804a1d2 in main (argc=1, argv=0xbffff2d4) at reopen.c:126

Finally, to answer your question (sorry, slow today): no, GLFW doesn’t
officially support VirtualBox, although it’d certainly be nice for it to work
there. I currently have my hands full with GLFW 3, but I’ll help if I can.

Are there any updates on this matter?
I am currently testing a GLFW application (already tested in host systems) within two VirtualBox VM (Windows 10 & Ubuntu), MacOS host, and it fails in both with the same runtime error (failed to create GLFW window). A colleague of mine apparently did the same on a Windows host and it worked for him (same VM settings).

Hi @Harniver,

Welcome to the GLFW forum.

This is potentially a different issue as you are running on a MacOS host. It is possible that the host + VirtualBox does not support hardware OpenGL with a Windows client, in which case GLFW will fail to create a window unless GLFW_CLIENT_API window hint is set to GLFW_NO_API before opening the window, but then OpenGL will not be available.

Cheers,

Doug.