2011-05-20 145 views
1

我正在使用this book來學習OpenGL。我試圖運行第一個示例,即here。它編譯罰款,但是當我嘗試運行它,我得到一個X11 BadAlloc錯誤:X11來自OpenGL的BadAlloc錯誤

X Error of failed request: BadAlloc (insufficient resources for operation) 
Major opcode of failed request: 128 (GLX) 
Minor opcode of failed request: 34() 
Serial number of failed request: 38 
Current serial number in output stream: 39 

據我所知,這是錯誤時引起glutCreateWindow被調用。我不知道這是X本身還是我的顯卡(它是nVidia GeForce 310)的問題。

回答

3

您的圖形驅動程序不支持OpenGL版本4.0。

glutInitContextVersion(4, 0); 

我把它改爲3.3:

glutInitContextVersion(3, 3); 

,它工作正常。你可以從glxinfo得到你的OpenGL版本。

+0

呵呵。謝謝。這就說得通了。我想我會看看我能做些什麼來使它兼容... – 2011-05-20 16:43:22

+1

它通常歸結爲更新您的驅動程序。如果這不起作用,那你就無能爲力。但無論如何,堅持3.3;如果你是初學者,4.0不會給你帶來太多的好處。 – Calvin1602 2011-05-20 17:21:36