Tuesday, 28 June 2011

Running GLUT program in Fedora under VirtualBox

I've been developing OpenGL programs with GLUT in order to achieve cross-platform compatibility. However, while testing my programs under Fedora 15 using VirtualBox 4.0.10, I get stucked with some error message:

OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x180fb10
OpenGL Warning: Retry with 0x8002 returned 0 visuals
Segmentation fault (core dumped)

I was pretty sure my program was correct and the error occurs every time when glutCreateWindow is called. After searching on the Internet, I found this problem has something to do with the OpenGL acceleration in VMs. The simplest fix I found is to add LIBGL_ALWAYS_INDIRECT=1 environment variable before running my GLUT programs. I am no expert in Linux environment variable settings nor do I know much about GLUT itself, however, it does fixes my issue. I guess there might be some trade-off in changing the default settings, yet it is to be found in my future test, so far it is a perfect solution to my programs.

1 comment:

  1. sir i have the same error for an android program on emulator in eclipse.Using a VM and its 3Daccleration is enabled. it a pure java program "main.java" Where should i type "LIBGL_ALWAYS_INDIRECT=1 "

    ReplyDelete