GLSL 1.5 on OSX?

Hi all,
just got myself a new retina laptop and am keen to learn shaders. I was hoping I could use GLSL 1.5 as the machine should support it but the below code tells me I only have 1.2? Is there a way around this?

// Get GLSL version  
		string glslVersion = string((const char *)glGetString(GL_SHADING_LANGUAGE_VERSION));  
		uint32_t spaceIndex = glslVersion.find_first_of(" ");  
		if (spaceIndex > 0)  
			glslVersion = glslVersion.substr(0, spaceIndex);  
		trace("GLSL version: " + glslVersion);  

Mac OS X supports GLSL 1.5 (according to the Open GL Extensions-app) but only for the core-profile (which means OpenGL 3.2). So you have to create your OpenGL context with the CoreProfile attribute

NSOpenGLPixelFormatAttribute pixelFormatAttributes[] =  
        NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,  

I don’t know if OpenFrameWorks is capable of doing this.

More info:

Open GL 3.0 changes a lot of things, the fixed function pipeline (glBegin glEnd) got removed, basically you’ll have to to all your renderings with shaders.


Thanks Stephan,
I’d be happy to change the way I code to use VBOs instead glBegin/End etc but I’m not that keen to move outside of vanilla OF if addons and things will break. Looks like I may just have to learn shaders with GLSL 1.2 instead then.

It is worth noting that with v0.8.0 and later, the ofGLProgrammableRenderer will use the core profile on OS X and in turn allows more recent versions of GLSL.

Has anyone managed to do this? Adding the code sth suggested, doesn’t seem to have any effect on the version of GLSL used. Is there anything else I need to add to my code to get it to work?

To my knowledge, I am using 0.8

Hey @nathaniel, what version of oF are you using? Could you post the code you are using and a bit more detail on what you are trying to achieve?

You shouldn’t need to set the set the pixel format yourself anymore and instead simply change your main.cpp to use the programmable renderer via:

int main() {
    ofSetupOpenGL(1024, 768, OF_WINDOW);
    ofRunApp(new slideshowApp());

On my machine, GL_SHADING_LANGUAGE_VERSION then provides 4.10, so you’d just need to prefix your shaders if you intended to use 1.5.

Oh well, apparently, I’m not using (and can’t use) version 0.8, so that I can’t use “ofGLProgrammableRenderer”. I’m using an older version of OF (0.7.03?), and it would be nice to able to use a shader newer than 2006, so I can use things like integer 1D textures or uniform buffers that can load data from CPU memory and then use it inside a fragment shader.

As I understand it, I can draw to an “ofTexture”, but cannot fill it by copying CPU data, although I’d be happy to stand corrected.


You’re correct, UBOs are only available in OpenGL 3+ texture1D is available in GL2.0 (which is what OF0.7 supports).

Shame you’re stuck on OF 0.7 as the programmable renderer is a really important step forward for OF.