GLSL version #430 support

I am trying to learn how to use shaders and have a book that uses GLSL version 430. I was wondering how I setup an openGL project to run this version?

Thanks

I usually use this code in the main.cpp

int main( ){
    ofGLFWWindowSettings settings;
    settings.setGLVersion(4, 3); //version of opengl corresponding to your GLSL version
    settings.width = 1280;
    settings.height = 720;
    ofCreateWindow(settings);
    ofRunApp(new ofApp());
}

Yeah I was trying to use that code and for some reason I get a crash: program = glCreateProgram(); bad_access

and these errors in the terminal

[ error ] ofAppGLFWWindow: 65543: The requested client API version is unavailable
[ error ] ofAppGLFWWindow: couldn’t create GLFW window
[ error ] ofAppGLFWWindow: 65538: There is no current context
[verbose] ofShader: checkAndCreateProgram(): creating GLSL program
(lldb)

Are you trying to do it in a virtual machine or in a headless computer? also you can run the glInfoExample to check if your card supports that version of opengl.

Also in mac you are limited to opengl 4.1 as the newer option.

Ah ok, yes, I’m on a mac. 4.1 worked! thanks.

Quick note on that, you are limited to shaders that uses instructions supported in GLSL 410, for example there is no support of compute shaders.

So compute shaders don’t work on a mac then? I think i’m a little away from that at the moment anyway, just taking little baby steps at the moment - one day though :slight_smile: