ENH: shader: add logic to avoid error when opengl version less than 3.0

use a seperate shader for function which needs opengl 3.0 supports

Change-Id: Iff30a90211aa10ae9c4a1e36afeb331d252fb814
This commit is contained in:
lane.wei 2022-10-16 23:21:10 +08:00 committed by Lane.Wei
parent c9c98dcee8
commit 227e1f4dc3
5 changed files with 218 additions and 38 deletions

View file

@ -1,4 +1,4 @@
#version 130
#version 110
#define INTENSITY_CORRECTION 0.6
@ -43,8 +43,6 @@ varying vec4 world_pos;
varying float world_normal_z;
varying vec3 eye_normal;
varying vec3 barycentric_coordinates;
void main()
{
// First transform the normal into camera space and normalize the result.
@ -72,8 +70,4 @@ void main()
gl_Position = ftransform();
// Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded.
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
//compute the Barycentric Coordinates
int vertexMod3 = gl_VertexID % 3;
barycentric_coordinates = vec3(float(vertexMod3 == 0), float(vertexMod3 == 1), float(vertexMod3 == 2));
}