X 请求失败错误:BadMatch
我正在尝试执行一些“hello world”opengl 代码:
#include <GL/freeglut.h>
void displayCall() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
... Some more code here
glutSwapBuffers();
}
int main(int argc, char *argv[]) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(500, 500);
glutInitWindowPosition(300, 200);
glutInitContextVersion(4, 2);
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
glutCreateWindow("Hello World!");
glutDisplayFunc(displayCall);
glutMainLoop();
return 0;
}
结果我得到:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 128 (GLX)
Minor opcode of failed request: 34 ()
Serial number of failed request: 39
Current serial number in output stream: 40
这是堆栈跟踪:
fghCreateNewContext() at freeglut_window.c:737 0x7ffff7bbaa81
fgOpenWindow() at freeglut_window.c:878 0x7ffff7bbb2fb
fgCreateWindow() at freeglut_structure.c:106 0x7ffff7bb9d86
glutCreateWindow() at freeglut_window.c:1,183 0x7ffff7bbb4f2
main() at AlphaTest.cpp:51 0x4007df
这是程序崩溃后的最后一段代码:
createContextAttribs =
(CreateContextAttribsProc) fghGetProcAddress("glXCreateContextAttribsARB" );
if ( createContextAttribs == NULL ) {
fgError( "glXCreateContextAttribsARB not found" );
}
context = createContextAttribs( dpy, config, share_list, direct, attributes );
“glXCreateContextAttribsARB”地址已成功获取,但是程序在调用时崩溃。
如果我在“glutInitContextVersion()”中指定小于 4.2 的 OpenGL 版本,程序运行不会出现错误。
这是我的 glxinfo 的 OpelGL 版本:
OpenGL version string: 4.2.0 NVIDIA 285.05.09
如果有任何进一步的想法,我将非常感激。
I'm trying to execute some "hello world" opengl code:
#include <GL/freeglut.h>
void displayCall() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
... Some more code here
glutSwapBuffers();
}
int main(int argc, char *argv[]) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(500, 500);
glutInitWindowPosition(300, 200);
glutInitContextVersion(4, 2);
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
glutCreateWindow("Hello World!");
glutDisplayFunc(displayCall);
glutMainLoop();
return 0;
}
As a result I get:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 128 (GLX)
Minor opcode of failed request: 34 ()
Serial number of failed request: 39
Current serial number in output stream: 40
Here is the stack trace:
fghCreateNewContext() at freeglut_window.c:737 0x7ffff7bbaa81
fgOpenWindow() at freeglut_window.c:878 0x7ffff7bbb2fb
fgCreateWindow() at freeglut_structure.c:106 0x7ffff7bb9d86
glutCreateWindow() at freeglut_window.c:1,183 0x7ffff7bbb4f2
main() at AlphaTest.cpp:51 0x4007df
Here is the last piece of code, after witch the program crashes:
createContextAttribs =
(CreateContextAttribsProc) fghGetProcAddress("glXCreateContextAttribsARB" );
if ( createContextAttribs == NULL ) {
fgError( "glXCreateContextAttribsARB not found" );
}
context = createContextAttribs( dpy, config, share_list, direct, attributes );
"glXCreateContextAttribsARB" address is obtained successfully, but the program crashes on its invocation.
If I specify OpenGL version less than 4.2 in "glutInitContextVersion()" program runs without errors.
Here is my glxinfo's OpelGL version:
OpenGL version string: 4.2.0 NVIDIA 285.05.09
I would be very appreciate any further ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论