0

I'm trying to understand OpenGL shaders.
I'm working on windows and my OpenGL version is 3.0.
I have a file that should draw a triangle and change its color every 3 seconds but when I debug I get a warning (see in the pic below) and I can see only a triangle that doesn't change its color. I followed the guide from this website: Source code is here.

I changed shaders version to 130 according with the best answer of this question, but I keep getting this warning.

Here it is a screenshot of my error:

enter image description here

Community
  • 1
  • 1
splunk
  • 6,435
  • 17
  • 58
  • 105
  • 2
    did you change these lines `glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);` `glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);` in the source code? – Gnimuc Aug 07 '15 at 12:22
  • @GnimucKey No I didn't change them, what should I change in these lines? – splunk Aug 07 '15 at 12:30
  • 2
    Layout qualifiers are not supported in 130. – BDL Aug 07 '15 at 12:42
  • @GreenMamba `glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);` should be `0` cause your OpenGL version is 3.`0`. – Gnimuc Aug 07 '15 at 13:02
  • 1
    i highly recommend you to upgrade your graphic card in order to learn `Modern GL`. after changing the minor version to 0, you may need to comment the following line `glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);`, and next, you need to adjust your shader code... – Gnimuc Aug 07 '15 at 13:07
  • If you're going to recommend an upgrade for something more modern, shouldn't he go outside and climb trees or something, and wait for Vulkan? – Robinson Aug 07 '15 at 13:48
  • Thanks to everybody, I solved it. I changed the graphic card (I was using the integrated graphic card) and I installed the latest driver and the warnings disappeared following instructions. – splunk Aug 07 '15 at 16:12
  • 1
    @Robinson no, you may misunderstood me. the tutorials that OP is using says `...This is also the reason why our tutorials are geared at Core-Profile OpenGL version 3.3. ...`, i should write `in order to meet the demand of that tutorial`. sorry about that :) – Gnimuc Aug 07 '15 at 18:10

1 Answers1

1

The location layout qualifier is only supported in GLSL 3.30 and later. So the version you need to specify at the start of your shader code to use this feature is:

#version 330

Also, you tried to use:

#version 130 core

This is not a valid version. The profile part of the version definition was only introduced in GLSL 1.50.

Reto Koradi
  • 53,228
  • 8
  • 93
  • 133