<p>There is no such thing as a core profile in GLSL 1.30. The concept of API profiles was introduced with OpenGL 3.2 which happened after GLSL 1.30 was released. The syntax for the version specification in <a href="https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.1.30.pdf" rel="nofollow noreferrer">GLSL 1.30</a> is </p>

<pre><code>#version &lt;number&gt;
</code></pre>

<p>Apart from that, I highly recommend that you check to confirm that GLSL 1.30 <em>really</em> is the maximum version you're supposed to be able to use on your system. It seems not unlikely that you just don't have a proper OpenGL driver installed. Even software implementations like MESA support more recent versions than that these days…</p>

CC BY-SA 4.0
2019-01-09T13:57:50.437Z
Thanks, the provided syntax has been very useful. I checked about version, under the virtual machine the version number of GLSL is 1.30 and 99% i will not allowed to update the drivers, even if it is possible. (yes, I am forced to work under this virtual machine)
marcoresk
CC BY-SA 4.0
2019-01-09T14:06:54.767Z
Well, if this is a virtual machine which you can't change and are forced to use, then I guess 1.30 is, unfortunately, indeed what you're stuck with…
Michael Kenzel
CC BY-SA 4.0
2019-01-08T14:31:07.597Z
2019-01-09T00:08:49.577Z
2019-01-09T00:08:49.577Z
Michael Kenzel
<p>I'm a newbie with OpenGl and I'm stuck in following the tutorial. 
I found <a href="https://open.gl/textures" rel="nofollow noreferrer">this tutorial</a> with these shaders</p>

<pre><code>// Shader sources
const GLchar* vertexSource = R"glsl(
    #version 150 core
    in vec2 position;
    in vec3 color;
    in vec2 texcoord;
    out vec3 Color;
    out vec2 Texcoord;
    void main()
    {
        Color = color;
        Texcoord = texcoord;
        gl_Position = vec4(position, 0.0, 1.0);
    }
)glsl";
const GLchar* fragmentSource = R"glsl(
    #version 150 core
    in vec3 Color;
    in vec2 Texcoord;
    out vec4 outColor;
    uniform sampler2D tex0;
    void main()
    {
        outColor = texture(tex0, Texcoord) * vec4(Color, 1.0);
    }
)glsl";
</code></pre>

<p>I noticed that the proposed shaders couldn't compile in my computer, since my GLsl version is 1.30, but changing the version declaration into</p>

<pre><code>#version 130 core
</code></pre>

<p>the ouput of this instruction is <code>glGetShaderInfoLog(vertexShader, 512, NULL, infoLog)</code>;</p>

<blockquote>
  <p>0:2(10): error: illegal text following version number</p>
</blockquote>

<p>I wuould like to understand what is wrong in this shader (in version 1.30) or at least where to find enough information to "repair" this situation.
Thanks</p>

<p><strong>#UPDATE 1</strong>
I managed to have compiling shaders with no errors, but still the program does not work.</p>

<pre><code>// Shader sources
//in --&gt; attribute
//out --&gt; varying
const GLchar* vertexSource = R"glsl(
    #version 130
    attribute vec2 position;
    attribute vec3 color;
    attribute vec2 texcoord;
    varying vec3 Color;
    varying vec2 Texcoord;
    void main()
    {
        Color = color;
        Texcoord = texcoord;
        gl_Position = vec4(position, 0.0, 1.0);
    }
)glsl";

//in --&gt; varying
//out --&gt; (delete)
const GLchar* fragmentSource = R"glsl(
    #version 130
    varying vec3 Color;
    varying vec2 Texcoord;
    uniform sampler2D tex0;
    void main()
    {
       gl_FragColor = texture2D(tex0, Texcoord) * vec4(Color, 1.0);
    }
)glsl";
</code></pre>

<p>I used some functions like this to confirm that shaders are successfully compiled and linked</p>

<pre><code>int success; char infoLog[512];
glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &amp;success); 
//can also use GL_LINK_STATUS flag
if(!success)
{
    glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);
    std::cout &lt;&lt; "ERROR::SHADER::VERTEX::COMPILATION_FAILED\n" &lt;&lt; infoLog &lt;&lt; std::endl;
    std::cout &lt;&lt;  glGetString(GL_SHADING_LANGUAGE_VERSION) &lt;&lt; std::endl;
    std::cout &lt;&lt;  success &lt;&lt; std::endl;
};
</code></pre>

CC BY-SA 4.0
2019-01-08T12:57:49.923Z
I'm guessing a bit, so you will have to try around. However, you probably don't need the `core` annotation, i'm not even sure it exists for version 130. I couldn't find anything on the fly that would confirm this though.
Some older versions don't support `texture` for access of textures, so you may need a `texture2D` here. 
All that being said, are your sure your glsl version is 130? That is extremely old. What kind of graphics card are you using?
Tare
CC BY-SA 4.0
2019-01-08T13:16:56.240Z
@Tare thank you. I will try your suggestion. I am sure about glsl version, confirmed both from line code glGetString(GL_SHADING_LANGUAGE_VERSION) and from terminal (glxinfo |grep version). Not sure about the graphics card, because the core runs under a virtual machine.
marcoresk
<opengl><shader><glsl>
Convert shader from GLsl 1.50 to 1.30
marcoresk
# Convert shader from GLsl 1.50 to 1.30

(Asked by: username_0 on 2019-01-08)

I'm a newbie with OpenGl and I'm stuck in following the tutorial. 
I found this tutorial with these shaders
// Shader sources
const GLchar* vertexSource = R"glsl(
    #version 150 core
    in vec2 position;
    in vec3 color;
    in vec2 texcoord;
    out vec3 Color;
    out vec2 Texcoord;
    void main()
    {
        Color = color;
        Texcoord = texcoord;
        gl_Position = vec4(position, 0.0, 1.0);
    }
)glsl";
const GLchar* fragmentSource = R"glsl(
    #version 150 core
    in vec3 Color;
    in vec2 Texcoord;
    out vec4 outColor;
    uniform sampler2D tex0;
    void main()
    {
        outColor = texture(tex0, Texcoord) * vec4(Color, 1.0);
    }
)glsl";

I noticed that the proposed shaders couldn't compile in my computer, since my GLsl version is 1.30, but changing the version declaration into
#version 130 core

the ouput of this instruction is glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);

0:2(10): error: illegal text following version number

I wuould like to understand what is wrong in this shader (in version 1.30) or at least where to find enough information to "repair" this situation.
Thanks
#UPDATE 1
I managed to have compiling shaders with no errors, but still the program does not work.
// Shader sources
//in --> attribute
//out --> varying
const GLchar* vertexSource = R"glsl(
    #version 130
    attribute vec2 position;
    attribute vec3 color;
    attribute vec2 texcoord;
    varying vec3 Color;
    varying vec2 Texcoord;
    void main()
    {
        Color = color;
        Texcoord = texcoord;
        gl_Position = vec4(position, 0.0, 1.0);
    }
)glsl";

//in --> varying
//out --> (delete)
const GLchar* fragmentSource = R"glsl(
    #version 130
    varying vec3 Color;
    varying vec2 Texcoord;
    uniform sampler2D tex0;
    void main()
    {
       gl_FragColor = texture2D(tex0, Texcoord) * vec4(Color, 1.0);
    }
)glsl";

I used some functions like this to confirm that shaders are successfully compiled and linked
int success; char infoLog[512];
glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success); 
//can also use GL_LINK_STATUS flag
if(!success)
{
    glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);
    std::cout << "ERROR::SHADER::VERTEX::COMPILATION_FAILED\n" << infoLog << std::endl;
    std::cout <<  glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
    std::cout <<  success << std::endl;
};

**Tags:** opengl, shader, glsl
> **Comments:**
> **username_1**: I'm guessing a bit, so you will have to try around. However, you probably don't need the `core` annotation, i'm not even sure it exists for version 130. I couldn't find anything on the fly that would confirm this though. Some older versions don't support `texture` for access of textures, so you may need a `texture2D` here.  All that being said, are your sure your glsl version is 130? That is extremely old. What kind of graphics card are you using?  
> **username_0**: @Tare thank you. I will try your suggestion. I am sure about glsl version, confirmed both from line code glGetString(GL_SHADING_LANGUAGE_VERSION) and from terminal (glxinfo |grep version). Not sure about the graphics card, because the core runs under a virtual machine.  

---

## 1 answers

### Answer by username_2 on 2019-01-08. Score: 4

There is no such thing as a core profile in GLSL 1.30. The concept of API profiles was introduced with OpenGL 3.2 which happened after GLSL 1.30 was released. The syntax for the version specification in GLSL 1.30 is 
#version 

Apart from that, I highly recommend that you check to confirm that GLSL 1.30 really is the maximum version you're supposed to be able to use on your system. It seems not unlikely that you just don't have a proper OpenGL driver installed. Even software implementations like MESA support more recent versions than that these days…

> **Comments:**
> **username_0**: Thanks, the provided syntax has been very useful. I checked about version, under the virtual machine the version number of GLSL is 1.30 and 99% i will not allowed to update the drivers, even if it is possible. (yes, I am forced to work under this virtual machine)  
> **username_2**: Well, if this is a virtual machine which you can't change and are forced to use, then I guess 1.30 is, unfortunately, indeed what you're stuck with…  

---

