2
\$\begingroup\$

I have the following four lines before I create the window.

SDL_Init(SDL_INIT_VIDEO);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);

My shaders are of #version 320 core but I get these errors, the first from the vertex shader and the second from the fragment shader.

ERROR: 0:1: '' : version '320' is not supported ERROR: 0:1: '' : syntax error: #version ERROR: 0:2: '' : #version required and missing. ERROR: 0:4: '0' : syntax error: integers in layouts require GLSL 140 or later

ERROR: 0:1: '' : version '320' is not supported ERROR: 0:1: '' : syntax error: #version ERROR: 0:2: '' : #version required and missing.

I am on OS X El Capitan but this setup worked before with Java.

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

Wikipedia says that OpenGL 3.2 uses GLSL 1.50.11. Thus, you need to use #version 150 core.

https://en.wikipedia.org/wiki/OpenGL_Shading_Language

\$\endgroup\$
1
  • \$\begingroup\$ That does indeed solve the problem. Note that 150 core still uses the old format but it does function perfectly well. \$\endgroup\$
    – Lucien
    Commented Nov 15, 2015 at 19:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .