4

I have a Qt code for an 3D application developed with OpenGL. I'm trying to build/run the Qt application with QtCreator but I'm getting the following error:

Error in compiling shader.

0:1(10): error: GLSL 3.30 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

I tried adding the following to my code as suggested by this answer:

QSurfaceFormat glFormat;
glFormat.setVersion(3, 3);
glFormat.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(glFormat);

Actually the above code worked, I mean the error got resolved. However, when application is running, it doesn't show/render any 3D content. For example when importing a STL file into the Qt application, the STL content is not shown. Did anybody run into a similar issue?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Megidd
  • 7,089
  • 6
  • 65
  • 142

1 Answers1

0

Just to help the next guy who might run into such an issue:


I built/ran the application on a computer belonging to a friend which has two graphic cards: one Intel and one Nvidia.

In the case of Intel graphics card the same previous issue occurred regarding OpenGL versions.

In the case of Nvidia graphics card, no OpenGL error happened. The application runs without any issue and the imported STL file could be rendered/viewed. Therefore my OpenGL error was hardware-related.


What I'm curious to know is how much effort would it take to modify the code so that the 3D application can run on Intel graphics card too. Who knows?

Megidd
  • 7,089
  • 6
  • 65
  • 142
  • 2
    If it runs on NVIDIA but not on Intel then you probably rely on a not standard conform behaviour of NVIDIA in your code. NVIDIA e.g. has a default VertexArrayObject bound to location `0`, which is not standard conform and not using VAO correctly is the most common error why code code runs on NVIDIA but not on Intel or ATI. – t.niese Jun 10 '18 at 14:16
  • @t.niese Thanks. I searched my project for the keyword `VertexArrayObject` but nothing is found. What other keyword might I search for to locate such an implementation? – Megidd Jun 10 '18 at 14:25
  • 1
    I don't know the QT API that well. But somewhere in your code you created a Buffer holding the data you want to render and you should create a VAO using `glGenVertexArrays`. You then tell the opengl where in the data like position, color, ... are located using `glVertexAttribPointer` and `glEnableVertexAttribArray`, before those functions you should have `glBindVertexArray`. So if `glBindVertexArray` or `glGenVertexArrays` are missing then you probably rely on that Nvidia error. – t.niese Jun 10 '18 at 14:35
  • @t.niese I just wonder if there is any good documentation which I can study to understand this topic. Thanks. – Megidd Jun 10 '18 at 14:40
  • @t.niese Specifically, I found `glEnableVertexAttribArray` and `glVertexAttribPointer` in the code, but there is **no** `glBindVertexArray` and also there is **no** `glGenVertexArrays` – Megidd Jun 10 '18 at 14:44
  • 1
    Either the [opengl specs](https://www.khronos.org/registry/OpenGL/specs/gl/glspec44.core.pdf) or the [official OpenGL Wiki](https://www.khronos.org/opengl/wiki/). There are some tutorials like [learnopengl.com - Hello-Triangle](https://learnopengl.com/Getting-started/Hello-Triangle) that seem to explain certain things quite well. But take care, all of the tutorials I know out there are either not well written or have errors. So you should always cross check with the offical wiki and specs. If you have further questions, please create a question with the explicit problem you have. – t.niese Jun 10 '18 at 14:57
  • @t.niese Great. I'm going to study those materials. Thanks. – Megidd Jun 11 '18 at 04:18