在 Linux 中执行 OpenGL 程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7435296/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 06:13:43  来源:igfitidea点击:

Executing OpenGL Programs in Linux

linuxopenglubuntu

提问by Bharath

I am trying to run opengl programs in linux, by connecting to a remote linux server. I connect using ssh and also provide the -X option, to use the X windowing system.

我试图通过连接到远程 linux 服务器在 linux 中运行 opengl 程序。我使用 ssh 连接并提供 -X 选项,以使用 X 窗口系统。

I am able to connect to the server and compile it. I successfully create the executable. Now when I run the executable, I get an error. It says

我能够连接到服务器并编译它。我成功创建了可执行文件。现在,当我运行可执行文件时,出现错误。它说

freeglut (./lineTest):  ERROR:  Internal error <FBConfig with necessary capabilities not found> in function fgOpenWindow
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  4 (X_DestroyWindow)
  Resource id in failed request:  0x0
  Serial number of failed request:  26
  Current serial number in output stream:  29

Where lineTest is the name of the executable.

其中 lineTest 是可执行文件的名称。

When I compile the code, I link it to both the glut and GLU libraries.

当我编译代码时,我将它链接到 glut 和 GLU 库。

Since the server is a remote server, I cannot make much driver changes.

由于服务器是远程服务器,我无法对驱动程序进行太多更改。

采纳答案by datenwolf

The first line of the error message is a telltale:

错误消息的第一行是一个告示:

freeglut (./lineTest):  ERROR:  Internal error <FBConfig with necessary capabilities not found> in function fgOpenWindow

… it means, that the X11 server the client is connected to doesn't support setting a framebuffer format that's required by OpenGL.

...这意味着,客户端连接到的 X11 服务器不支持设置 OpenGL 所需的帧缓冲区格式。

The first course of action is using glxinfoto check, what's actually supported. Please run glxinfoas you would your program and post its output here (most likely there's no OpenGL support somewhere in the line). Also execute glxinfolocally, since it is your local machine, that'll do all the OpenGL work.

第一个行动方案是glxinfo用来检查实际支持的内容。请glxinfo像您的程序一样运行并在此处发布其输出(很可能该行中的某处没有 OpenGL 支持)。也在glxinfo本地执行,因为它是您的本地机器,它将完成所有 OpenGL 工作。