GL 3.2 setting much slower than default OpenGL setting

hi, I was just playing around with ofLights and realized that all my scripts go a lot faster using the default window instancer

	ofSetupOpenGL(1024,768,OF_WINDOW);		

Than when I set the GL version manually like so

ofGLFWWindowSettings settings;
settings.setGLVersion(3, 2); //we define the OpenGL version we want to use
settings.setSize(1024, 768);
ofCreateWindow(settings);

Is this normal or am I doing something wrong ?
I’d really like to use shaders inside what I do, but for that I have to set the GL version to 3.2.
Are there any alternatives ?

Hi,
The performance difference might be because of your GPU model. What are you using? Which OS are you using?

Besides, you can always use shaders, regardless of these settings. Yet, the difference is that the code for shaders is slightly different when using GL3.2 or higher. The code you’ll find online most often is GL2 (which is the default, the one you set using ofSetupOpenGL(1024,768,OF_WINDOW); )

Take a look at the examples/shaders/ which have the shader code for both versions.

thanks for the quick answer ! i’m on windows 10 using a GTX 1080 Ti
I’d love to understand why it is like this if ever you have an idea.
is openframeworks lighting and 3D more optimized with GL2 than with GL3.2 ?

Ill go rewrite my glsl codes then :smiley:

Hi, well you have a quite powerful GPU, so it is not a problem of capabilities. Try to run the app in release mode and do the comparisons in that mode rather than debug, as on windows, debug mode tends to slow down a lot of precesses.

GL3.2 is often called the “programmable pipeline” or “programmable renderer” as you have to program and define everything through shaders, incuding lights. This gives you a lot more flexibility but you might need to add a lot more code to leverage with GL2 (although OF already does so for you :slight_smile: ). The lights in GL2 are part of the GL standard, you dont code anything of these but these are quite limited. In this sense, OF internaly uses shaders for lights when using GL3.2. These are quite standard so these should not behave slower than GL2. I would say that the problem is running on Debug mode. Let me know if running on Release mode fixes it

1 Like

gosh, I’m so used to python and processing that I didnt think of that. Thank you so much, you just solved a zillion other problems I had.

1 Like

cool, just to make sure and that this is useful to others, the fix is to use Release mode, right?

that’s what worked for me yes !

also you can enable some debug settings on the release mode:

1 Like