mirror of https://github.com/CGAL/cgal
add misisng highp in compatibility shaders
This commit is contained in:
parent
1761c62087
commit
e02eef8aa3
|
|
@ -162,12 +162,12 @@ const char vertex_source_color_comp[] =
|
|||
"void main(void)\n"
|
||||
"{\n"
|
||||
" fP = mv_matrix * vertex; \n"
|
||||
" mat3 mv_matrix_3; \n"
|
||||
" highp mat3 mv_matrix_3; \n"
|
||||
" mv_matrix_3[0] = mv_matrix[0].xyz; \n"
|
||||
" mv_matrix_3[1] = mv_matrix[1].xyz; \n"
|
||||
" mv_matrix_3[2] = mv_matrix[2].xyz; \n"
|
||||
" fN = mv_matrix_3* normal; \n"
|
||||
" fColor = vec4(color, 1.0); \n"
|
||||
" fColor = highp vec4(color, 1.0); \n"
|
||||
" gl_PointSize = point_size;\n"
|
||||
" gl_Position = mvp_matrix * vertex;\n"
|
||||
"}"
|
||||
|
|
@ -178,24 +178,24 @@ const char fragment_source_color_comp[] =
|
|||
"varying highp vec4 fP; \n"
|
||||
"varying highp vec3 fN; \n"
|
||||
"varying highp vec4 fColor; \n"
|
||||
"uniform vec4 light_pos; \n"
|
||||
"uniform vec4 light_diff; \n"
|
||||
"uniform vec4 light_spec; \n"
|
||||
"uniform vec4 light_amb; \n"
|
||||
"uniform float spec_power ; \n"
|
||||
"uniform highp vec4 light_pos; \n"
|
||||
"uniform highp vec4 light_diff; \n"
|
||||
"uniform highp vec4 light_spec; \n"
|
||||
"uniform highp vec4 light_amb; \n"
|
||||
"uniform highp float spec_power ; \n"
|
||||
|
||||
"void main(void) { \n"
|
||||
|
||||
" vec3 L = light_pos.xyz - fP.xyz; \n"
|
||||
" vec3 V = -fP.xyz; \n"
|
||||
" highp vec3 L = light_pos.xyz - fP.xyz; \n"
|
||||
" highp vec3 V = -fP.xyz; \n"
|
||||
|
||||
" vec3 N = normalize(fN); \n"
|
||||
" highp vec3 N = normalize(fN); \n"
|
||||
" L = normalize(L); \n"
|
||||
" V = normalize(V); \n"
|
||||
|
||||
" vec3 R = reflect(-L, N); \n"
|
||||
" vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor; \n"
|
||||
" vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
|
||||
" highp vec3 R = reflect(-L, N); \n"
|
||||
" highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor; \n"
|
||||
" highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
|
||||
|
||||
"gl_FragColor = light_amb*fColor + diffuse ; \n"
|
||||
"} \n"
|
||||
|
|
@ -212,7 +212,7 @@ const char vertex_source_p_l_comp[] =
|
|||
"void main(void)\n"
|
||||
"{\n"
|
||||
" gl_PointSize = point_size;\n"
|
||||
" fColor = vec4(color, 1.0); \n"
|
||||
" fColor = highp vec4(color, 1.0); \n"
|
||||
" gl_Position = mvp_matrix * vertex;\n"
|
||||
"}"
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void main(void) {
|
|||
gl_FragColor = vec4(d,d,d,1.0);
|
||||
else
|
||||
{
|
||||
vec4 my_color = vec4(color.xyz, 1.0);
|
||||
highp vec4 my_color = highp vec4(color.xyz, 1.0);
|
||||
highp vec3 L = light_pos.xyz - fP.xyz;
|
||||
highp vec3 V = -fP.xyz;
|
||||
highp vec3 N;
|
||||
|
|
@ -55,16 +55,16 @@ void main(void) {
|
|||
L = normalize(L);
|
||||
V = normalize(V);
|
||||
highp vec3 R = reflect(-L, N);
|
||||
vec4 diffuse;
|
||||
highp vec4 diffuse;
|
||||
if(is_two_side == 1)
|
||||
diffuse = abs(dot(N,L)) * light_diff * color;
|
||||
else
|
||||
diffuse = max(dot(N,L), 0.0) * light_diff * my_color;
|
||||
highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec;
|
||||
vec4 ret_color = vec4((my_color*light_amb).xyz + diffuse.xyz + specular.xyz,1);
|
||||
vec4 ret_color = highp vec4((my_color*light_amb).xyz + diffuse.xyz + specular.xyz,1);
|
||||
if(is_selected)
|
||||
gl_FragColor = vec4(ret_color.r+70.0/255.0, ret_color.g+70.0/255.0, ret_color.b+70.0/255.0, alpha);
|
||||
gl_FragColor = highp vec4(ret_color.r+70.0/255.0, ret_color.g+70.0/255.0, ret_color.b+70.0/255.0, alpha);
|
||||
else
|
||||
gl_FragColor = vec4(ret_color.xyz, alpha);
|
||||
gl_FragColor = highp vec4(ret_color.xyz, alpha);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue