Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the GLSL version on Mac

Tags:

macos

opengl

glsl

How does one go about setting the GLSL version on Mac? Is this even possible? I'm running a fragment shader and would like to create an array of vec3s, but the shader compiler is producing an error indicating that I need to use a higher GLSL version. The specific error is

'array of 3-component vector of float' : array type not supported here in glsl < 120 

Thanks for the help.

like image 966
TaylorP Avatar asked Aug 28 '11 22:08

TaylorP


1 Answers

Although I have no Mac experience, you can specify the lowest required version of your shader (which is 1.10 by default, I think) by using something like

#version 120      //shader requires version 1.20

as first line in your shader. But of course the specified version also has to be supported by your hardware and driver, which you can check for with glGetString(GL_SHADING_LANGUAGE_VERSION).

EDIT: I confirmed this with a look into the GLSL spec, which also says that all shaders that are linked together should target the same version, although I'm quite sure I myself have once successfully violated this, but this may be due to my forgiving nVidia driver. So if it still complains when linking, add the same #version tag to the vertex shader, too.

like image 132
Christian Rau Avatar answered Oct 24 '22 07:10

Christian Rau