'out cannot be used with an unchanging shader compilation error on the Nvidia driver, Intel works fine, AMD has another error

I tried to run a simple OpenGL 3 application with the following vertex shader program: -

in vec4 vPosition; out vec2 otexcoord; uniform mat4 modelview; uniform mat4 projection; void main() { gl_Position = projection * modelview * vPosition; otexcoord.s = vPosition.x; otexcoord.t = vPosition.y * -1.0; }; 

I ran this code on 3 GPUs from different companies, and the results are different.

  • There are no errors with the Intel driver and it works great.
  • With the Nvidia driver, the error "cannot be used with otexcoord unchanged".
  • Error with AMD driver: "Implicit version number 110, not supported by cross-compatible GL3 context"

AMD seems the least obvious. In fact, I have no idea about this.

Below is the query string

  • Intel: OpenGL 3.2.0 - Build 9.17.10.2932 GLSL 1.50 - Build 9.17.10.2932
  • Nvidia: OpenGL 3.2.0 GLSL 1.50 NVIDIA via Cg Compiler
  • AMD: OpenGL 3.2.12002 Context of the main profile 9.12.0.0 GLSL 4.20

Intel and Nvidia are similar, this is the GLSL 1.50 compiler. AMD - GLSL 4.20

Below is the question: -

  • Between Intel compilers and Nvidia, which works correctly in this case?
  • What does the error message from the AMD compiler mean? And what do I need to fix the error.
+4
source share
1 answer

You should always use the #version directive. If you do not, then the compiler will assume that you mean GLSL version 1.10. This means that out not a valid keyword.

+11
source

All Articles