$ g++ -IGL -lglut test2.cpp -o test.exe
就生成了test.exe
$ ./test.exe
显示:
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa082b78
OpenGL Warning: Retry with 0x8002 returned 0 visuals
Segmentation fault
网上搜了一下,得到解决方案
$ LIBGL_ALWAYS_INDIRECT=1 ./test.exe
运行结果:
按qwe进行xyz轴旋转,as放大缩小,上下左右移动,space换色,得到以下效果——