0

I'm following a tutorial on shader done using Visual Studio... I'm using Xcode on ElCapitan.

My readShaderCode() function pass the shaderCode files content ( vertex.glsl and fragment.glsl ) to the console --just to make sure-- along with the OpenGL version .

So this code works on Windows but not on my machine ! I can't see what the problem is and if somebody could figure it out for me I would really appreciate it! Thanks. And thanks for all the posts that have been helping me along for sometimes now :)

Here is the output:

    Working with OpenGl: 2.1 INTEL-10.14.66

    Here is the shader Code: 
    #version 120
    #extension GL_ARB_separate_shader_objects : enable

    in layout(location=0) vec2 position;
    in layout(location=1) vec3 vertexColor;

    out vec3 theColor;

    void main() {

        gl_Position = vec4(position, 0.0, 1.0);

        theColor = vertexColor;

    }

    *****************************************
    Working with OpenGl: 2.1 INTEL-10.14.66

    Here is the shader Code: 
    #version 120
    #extension GL_ARB_separate_shader_objects : enable

    out vec4 daColor; 
    in vec3 theColor; 

    void main() { 


    daColor = vec4(theColor, 1.0); 


    } 

    *****************************************
    WARNING: 0:2: extension 'GL_ARB_separate_shader_objects' is not                 supported
    ERROR: 0:4: '(' : syntax error: syntax error

1 Answer 1

3

You get perfectly reasonable errors and warnings.

WARNING: 0:2: extension 'GL_ARB_separate_shader_objects' is not supported

That means exactly what it says. Your shader depends on an extension that isn't supported.

ERROR: 0:4: '(' : syntax error: syntax error

There is only one ( character in line 4 of your vertex shader, so that makes it clear what the problem is.

This:

in layout(location=0) vec2 position;

Is not valid GLSL 1.20 code. GLSL 1.20 does not permit in qualified global variables, and GLSL 1.20 has no idea what layout means.

Your code is not reasonable GLSL code of the #version it is declared with. If another implementation took it, then you were relying on implementation-defined behavior.

Sign up to request clarification or add additional context in comments.

1 Comment

Ok. Thanks Nicol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.