user923
user923

Reputation: 559

OpenGL - Can you render shaders from GLSL 1.20 and GLSL 3.30 on a 3.30 profile?

I am trying to integrate freetype_gl and the shaders they use are for an older version. I can convert them to work with 3.3+, I am just wondering if that could be casing nothing to appear on the screen.

Upvotes: 1

Views: 1127

Answers (2)

Dietrich Epp
Dietrich Epp

Reputation: 213578

Short answer

On Windows, it will work. On OS X and Linux/Mesa it will not work.

Long answer

If you are using the compatibility profile, yes, it will work. If you are using the core profile, then GLSL versions before 1.40 will not be supported.

OpenGL implementations on Windows tend to have strong support for legacy applications, including the compatibility profile. Other implementations, such as Mesa and the OS X implementations, do not support newer versions of the compatibility profile. For non-core profiles, OS X only supports version 2.1 and Mesa supports 3.0.

This means that if you want to run your program on Linux/Mesa or OS X, you will have to port your shader to at least 1.40 (at which point you might as well use 3.30), but you don't have to change anything if you only care about Windows.

Upvotes: 4

Sung
Sung

Reputation: 1066

OpenGL and GLSL versions

Every OpenGL version since 2.0 has been released with a corresponding GLSL version. However, the GLSL version numbers were not always in sync with the GL version. Here is a table:

> OpenGL Version    GLSL Version
> 2.0               1.10
> 2.1               1.20
> 3.0               1.30
> 3.1               1.40
> 3.2               1.50

For all versions of OpenGL 3.3 and above, the corresponding GLSL version matches the OpenGL version. So GL 4.1 uses GLSL 4.10.

In my case, I am using glsl 1.30 with opengl 3.3 but I think you might not be able to use glsl 1.2 there

Upvotes: 1

Related Questions