livin_amuk
livin_amuk

Reputation: 1353

GLSL 1.2+ not supported on Mac OS?

I'm recieving the error

ERROR: 0:1: '' :  version '330' is not supported
ERROR: One or more attached shaders not successfully compiled

when trying to compile the following shader:

#version 330

in vec3 vPosition;
in  vec3 vColor;
out vec4 color;
uniform mat4 modelview;

void main()
{
    gl_Position = modelview * vec4(vPosition, 1.0);

    color = vec4( vColor, 1.0);
}

Re-writing the shader to version 110 spec compiles and runs fine:

#version 110

attribute vec3 vPosition;
attribute  vec3 vColor;
varying vec4 color;
uniform mat4 modelview;

void main()
{
    gl_Position = modelview * vec4(vPosition, 1.0);

    color = vec4( vColor, 1.0);
}

This worked for a while, but now I need to use 330 features.

I'm on a 2011 MacBook Pro running El Captian 10.11.2 and using the latest versions of OpenTK.dll and OpenTK.dll.config from the OpenTK website.

I have tried enabling the SDL2 backend by copying libSDL2.dylib from opentk/Dependencies/x86 to my application directory as suggested by another user, but no difference.

What must I do to support 330 features?

Upvotes: 0

Views: 1006

Answers (2)

livin_amuk
livin_amuk

Reputation: 1353

All MacBook Pros support at least OpenGL 3.3. The issue was in the defaults for OpenTK's GameWindow constructor. Their official documentation seems to imply that it defaults to OpenGL 2.1, but it definitely doesn't behave that way on Windows.

Adding this override fixed it.

public Game() : base(800, 600, new GraphicsMode(new ColorFormat(8), 3, 3, 4), "Welcome To Hell", GameWindowFlags.Default, DisplayDevice.Default, 3, 0, GraphicsContextFlags.Default)
{
}

Upvotes: 1

Michael IV
Michael IV

Reputation: 11424

If I remember correctly MAC driver on the latest OS have some issues with declaring of versions like 330.In fact from my experience it was GL 3.2 and then they added the support for 4.1 on Maveric and other latest OS releases. You can just use 410 because this is the current highest GL profile MAC OS X uses and of course it should export all the core extensions from 330.

Upvotes: 0

Related Questions