C ++ OpenGL阴影版本错误-不支持GLSL x [Ubuntu 16.04] [英] C++ OpenGL shading version error - GLSL x is not supported [Ubuntu 16.04]

查看:574
本文介绍了C ++ OpenGL阴影版本错误-不支持GLSL x [Ubuntu 16.04]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在Ubuntu 16.04上使用OpenGL进行项目开发,遇到了一个主要问题.在这一点上,我不知道该怎么办,因为我已经尝试了所有方法来解决此问题.

I am currently working on a project using OpenGL on Ubuntu 16.04 and have run into a major issue. At this point I have no idea what to do as it feels like I have tried everything in order to fix this.

由于某种原因,我的着色器无法编译并返回以下错误:

For some reason my shader just won't compile and returns the following error:

Failed to compile vertex shader!
0:1(10): error: GLSL 4.50 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES`

我已经调整了着色器文件中的版本,没有任何运气. #version 450 core等,但我一直得到相同的结果.

I have adjusted the version in the shader file without any luck. #version 450 core etc. but I keep getting the same result.

作为参考,这是sudo glxinfo | grep "OpenGL"的输出:

For reference, here is the output of sudo glxinfo | grep "OpenGL":

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 13.1.0-devel
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 13.1.0-devel
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 13.1.0-devel
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

glxinfo的输出显示已安装OpenGL core 4.5,为什么不支持此功能?

The output from glxinfo shows OpenGL core 4.5 is installed, so why is this not supported?

我还试图找到项目中使用的OpenGL的当前版本:std::cout << "OpenGL version: " << glGetString(GL_VERSION) << std::endl;,这将导致空白返回.

I have also tried to find the current version of OpenGL used in the project: std::cout << "OpenGL version: " << glGetString(GL_VERSION) << std::endl; which results in a blank return.

到目前为止,我已经在这个问题上花费了10个小时,因此我们将不胜感激!

I have spent 10 hours on this single issue until now, so any help is appreciated!

是否有办法通过完全删除GLSL(此部分)来强制项目/Ubuntu使用OpenGL而不是GLSL?

Is there a way to force the project/Ubuntu to use OpenGL and not GLSL by i.e. removing GLSL completely (this part)?

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 13.1.0-devel
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

推荐答案

对于遇到相同问题的其他人,这是对我有用的解决方案:

For anyone else experiencing the same issues, this was the solution that worked for me:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

这篇关于C ++ OpenGL阴影版本错误-不支持GLSL x [Ubuntu 16.04]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆