Opengl 3.3以上对应DX10以上,对应Shader Model4.0以上,GLSL版本3.3以上。
OpenGL 3.3以上的,Opengl版本和GLSL版本一致,例如:Opengl4.1和GLSL4.1一致。
1.2009/2012-至今win7/win8时代,Opengl 4.3(2012)也就是GLSL4.3对应D3D的Shader Model5.0 DX11-11.1-11.2,Opengl 4.4,4.5(2013-2014)也应该匹配DX11的Shader Model5.0。DX12的Shader Model5.1 应该没有最新的Opengl对应(opengl 还没有跟上Win10 2015时代)。
D3D的Shader Model4.0 DX10-10.1是在2006 win vista以上电脑的,相当于GLSL3.3版本也就是Opengl3.3,Opengl3.2用GLSL1.5也相当于shader model4.0。
2.2005-2009 win vista时代,Opengl 3.2-3.3(2009-2010)用GLSL1.5也相当于Shader Model4.0,DX10。
3.2001-2006 win xp时代,Opengl 3.0-3.1(2008-2009)的用GLSL 1.3-1.4 接近于Shader Model3.0 DX9.0c, Opengl 3.0用GLSL 1.3。
Shader Model 3,GLSL用1.3也就是Opengl3.0,很多匹配不上DX的Shader Model 2和3。
4. 2001-2006 win xp时代,Opengl 2.1用GLSL1.2(2006)对应DX9 Shader Model2.0, Opengl2.0 GLSL用1.1。
Opengl技术当前没有DX发展得迅速,当前扮演一个追随者的角色,但是本身的跨平台移动设备和大型机设备上的图形依然广泛应用。当前的win7电脑中还是安装的Opengl3.1.0也就是2009年的Opengl版本,用GLSL1.4类似DX shader model 2.0-3.0这样。When reading articles about graphics programming you come alone the term ‘Shader Model’ and version numbers for GLSL, OpenGL and Direct3D (depending on the API used in the article). While the described algorithms (nearly always) can be implemented in the ‘other’ API as well the different versioning schemes can be confusing – what OpenGL version and GLSL version do I need to implement this ‘Shader Model 4.0’ technique?
Note that you can’t always find an exact match for each version in the other API so take this chart with a grain of salt, its intension is to give you a rough overview of which API versions have a similar enough feature set to implement similar algorithms.
OpenGL | GLSL | Direct3D | Shader Model |
---|---|---|---|
2.1 | 120 | 9.0 | 2.0 |
3.3 | 330 | 10.0 | 4.0 |
4.2 | 420 | 11.0 | 5.0 |
GLSL versions went through some interesting number changes.
Until version 3.30, the GLSL version number and the corresponding OpenGL version number were different. Here's 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.
Direct3D Shader Model 4.0 is equivalent to GLSL version 3.30. Earlier GLSL versions for OpenGL 3.x provide subsets of this functionality, based on the available functionality in the OpenGL version, though 1.50 is almost feature-identical to SM4.
Direct3D Shader Model 5.0 is equivalent to GLSL version 4.30.
For earlier shader models, GLSL versions less than 1.30 are used. Because GLSL is a high-level language, many of the differences between SM 2 and 3 are not exposed to the user.
These are done through testing the presence of extensions. You should test them in this order:
ATI does not support higher than SM 2.0 functionality in assembly shaders.
The Shaders itself are also called differently (but serve the same purpose):
OpenGL | Direct3D |
---|---|
Vertex Shader | Vertex Shader |
Tessellation Control Shader | Hull Shader |
Tessellation Evaluation Shader | Domain Shader |
Geometry Shader | Geometry Shader |
Fragment Shader | Pixel Shader |
Compute Shader | Compute Shader |
Here’s a complete list of GLSL versions and the corresponding OpenGL versions (thank god the ARB changed the versioning scheme with OpenGL 3.3!):
OpenGL | #version | latest spec version number | Note |
---|---|---|---|
2.0 | 1.10.59 | ||
2.1 | 120 | 1.20.8 | |
3.0 | 130 | 1.30.10 | |
3.1 | 140 | 1.40.08 | |
3.2 | 150 | 1.50.11 | added Geometry Shaders |
3.3 | 330 | 3.30.6 | |
4.0 | 400 | 4.00.9 | added both Tessellation Shaders |
4.1 | 410 | 4.10.6 | |
4.2 | 420 | 4.20.11 | |
4.3 | 430 | 4.30.6 | added Compute Shaders |
Shaders in OpenGL were available even earlier thru extensions, early extensions were defined for OpenGL 1.3.
Also a more complete overview for Direct3D:
Direct3D | Shader Model | Note |
---|---|---|
8.0 | 1.0 – 1.3 | |
8.1 | 1.4 (PS) / 1.1 (VS) | |
9.0 | 2.0 | |
9.0c | 3.0 | |
10.0 | 4.0 | added Geometry Shaders |
10.1 | 4.1 | |
11.0 | 5.0 | added Domain & Hull Shaders |
https://www.opengl.org/wiki/History_of_OpenGL