# GLFW and VirtualBox?

**URL:** <https://discourse.glfw.org/t/glfw-and-virtualbox/242>\
**Category:** support\
**Created:** [March 5, 2012, 1:08pm UTC](https://discourse.glfw.org/t/glfw-and-virtualbox/242 "2012-03-05T13:08:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [March 5, 2012, 1:08pm UTC](https://discourse.glfw.org/t/glfw-and-virtualbox/242/1 "2012-03-05T13:08:47Z")

</div>

**[honestguvnor](https://sourceforge.net/u/honestguvnor/)** wrote on [Monday, March 05, 2012](https://sourceforge.net/p/glfw/discussion/247562/thread/98843c84/#5a32):

What is the expected behaviour of GLFW running under VirtualBox?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [March 6, 2012, 1:30am UTC](https://discourse.glfw.org/t/glfw-and-virtualbox/242/2 "2012-03-06T01:30:20Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Tuesday, March 06, 2012](https://sourceforge.net/p/glfw/discussion/247562/thread/98843c84/#fef4):

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [March 6, 2012, 1:00pm UTC](https://discourse.glfw.org/t/glfw-and-virtualbox/242/3 "2012-03-06T13:00:47Z")

</div>

**[honestguvnor](https://sourceforge.net/u/honestguvnor/)** wrote on [Tuesday, March 06, 2012](https://sourceforge.net/p/glfw/discussion/247562/thread/98843c84/#39b3):

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](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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [March 6, 2012, 1:13pm UTC](https://discourse.glfw.org/t/glfw-and-virtualbox/242/4 "2012-03-06T13:13:57Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Tuesday, March 06, 2012](https://sourceforge.net/p/glfw/discussion/247562/thread/98843c84/#c53c):

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [March 7, 2012, 12:15am UTC](https://discourse.glfw.org/t/glfw-and-virtualbox/242/5 "2012-03-07T00:15:44Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Wednesday, March 07, 2012](https://sourceforge.net/p/glfw/discussion/247562/thread/98843c84/#a54e):

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.

---

<div class="post-metadata">

**Author:** ![Harniver](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/harniver/32/445_2.png) [@Harniver](https://discourse.glfw.org/u/Harniver)\
**Post date:** [December 26, 2020, 10:46am UTC](https://discourse.glfw.org/t/glfw-and-virtualbox/242/6 "2020-12-26T10:46:27Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [December 26, 2020, 11:06am UTC](https://discourse.glfw.org/t/glfw-and-virtualbox/242/7 "2020-12-26T11:06:14Z")

</div>

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.
