2016-03-06 55 views
1

,當我得到這個錯誤,當我嘗試執行我的計劃:libGL函數錯誤執行的OpenGL程序

libGL error: unable to load driver: i965_dri.so 
libGL error: driver pointer missing 
libGL error: failed to load driver: i965 
libGL error: unable to load driver: swrast_dri.so 
libGL error: failed to load driver: swrast 
X Error of failed request: GLXBadFBConfig 
    Major opcode of failed request: 154 (GLX) 
    Minor opcode of failed request: 34() 
    Serial number of failed request: 42 
    Current serial number in output stream: 41 

我的代碼(我把它從「OpenGL開發的食譜」一書):

#include <GL/glew.h> 
#include <GL/freeglut.h> 
#include <iostream> 

const int WIDTH = 640; 
const int HEIGHT = 480; 

void OnInit() 
{ 
    glClearColor(1, 0, 0, 0); 
    std::cout << "Initialization successfull" << std::endl; 
} 

void OnShutdown() 
{ 
    std::cout << "Shutdown successfull" << std::endl; 
} 

void OnResize(int nw, int nh) 
{ 

} 

void OnRender() 
{ 
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    glutSwapBuffers(); 
} 

int main(int argc, char** argv) 
{ 
    glutInit(&argc, argv); 
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); 
    glutInitContextVersion(3, 3); 
    glutInitContextFlags(GLUT_CORE_PROFILE | GLUT_DEBUG); 
    glutInitContextProfile(GLUT_FORWARD_COMPATIBLE); 
    glutInitWindowSize(WIDTH, HEIGHT); 
    glutCreateWindow("OpenGL"); 

    glewExperimental = GL_TRUE; 
    GLenum err = glewInit(); 

    if(GLEW_OK != err) {std::cerr << "Error: " << glewGetErrorString(err) << std::endl; } 
    else{if(GLEW_VERSION_3_3) {std::cout << "Driver supports OpenGL 3.3\n Details: " << std::endl; }} 

    std::cout << "\tUsing glew: " << glewGetString(GLEW_VERSION) << std::endl; 
    std::cout << "\tVendor: " << glGetString(GL_VENDOR) << std::endl; 
    std::cout << "\tRenderer: " << glGetString(GL_RENDERER) << std::endl; 
    std::cout << "\tGLSL: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl; 

    OnInit(); 
    glutCloseFunc(OnShutdown); 
    glutDisplayFunc(OnRender); 
    glutReshapeFunc(OnResize); 
    glutMainLoop(); 
    return 0; 
} 

我驗證了,如果我的驅動程序支持,我與glxinfo用OpenGL版本| grep的 「OpenGL的」命令:

OpenGL vendor string: Intel Open Source Technology Center 
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile 
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.5.9 
OpenGL core profile shading language version string: 3.30 
OpenGL core profile context flags: (none) 
OpenGL core profile profile mask: core profile 
OpenGL core profile extensions: 
OpenGL version string: 3.0 Mesa 10.5.9 
OpenGL shading language version string: 1.30 
OpenGL context flags: (none) 
OpenGL extensions: 

我使用Ubuntu的14.04.3

我不知道,但我想是因爲我使用英特爾,而不是Nvidia的我得到這個錯誤。

回答

0

很難從遠處看出來,但是您在那裏看到的錯誤看起來像一個損壞的OpenGL客戶端庫安裝。 glxinfo查詢加載到Xorg服務器,這是從安裝libGL函數有些獨立的GLX驅動程序(只要只能間接渲染調用製造)。錯誤表明安裝的libGL與DRI驅動程序不匹配或DRI庫損壞。

無論哪種方式,最好的行動當然是盡一切有關OpenGL的系統上的一個乾淨的重新安裝。即做了xorg-服務器的xf86-video- ...,檯面,libdri ...等的強制重新安裝。

+0

我怎麼重新安裝它們,我只是刪除和安裝? – Delta

+0

您使用的是Ubuntu,因此我建議'apt-get install --reinstall libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa i965-va-driver libdrm-intel1 xserver-xorg-video-intel xserver-xorg libdrm2'應該照顧參與英特爾圖形的所有軟件包。 – datenwolf

+0

我做到了,現在我得到這樣的: '失敗請求的X錯誤:GLXBadFBConfig 失敗請求的主要操作碼:154(GLX) 失敗請求的次操作碼:34() 失敗請求的序列號:36 輸出流中的當前序列號:35' 它不像以前那樣 – Delta

0

我面臨着一個非常類似的錯誤:

X Error of failed request: GLXBadFBConfig 
    Major opcode of failed request: 154 (GLX) 
    Minor opcode of failed request: 34() 
    Serial number of failed request: 42 
    Current serial number in output stream: 41 

刪除以下行解決它:

glutInitContextVersion(3, 3);