GLSL Supported ARB_fragment_program is supported. ALU instructions: 512 texture instructions: 512 texture indirections: 4 local parameters: 1024 env parameters: 128 temp registers: 64 attributes: 10 ARB_vertex_program is supported. ALU instructions: 0 texture instructions: 0 texture indirections: 0 local parameters: 1024 env parameters: 256 temp registers: 65535 attributes: 32 Reading symbols for shared libraries .. done GLSL GHash init GLSL deactivated. Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done GLSL Light created. GLSL Material created. GLSL MaterialTree created. GLSL Program created. GLSL Shader code writing... GLSL Shader Compiled. J GLSL Shader Compile Error Code: struct light{ vec3 loc; vec3 vec; vec3 color; float dist; float energy; float att1; float att2; float att3; float att4; float gamma; float area_x; float area_y; float sphere; float square; float area_type; float layer; mat4 mat; float areasize; float k; float spotsize; float spotblend; }; varying vec3 vert_color; varying vec3 normal, pos; varying vec4 realcolor; uniform vec3 eye; uniform vec3 amb_color; uniform float amb_exp, amb_range;uniform vec3 u_mat_0_diff_color; uniform vec3 u_mat_0_spec_color; uniform vec3 u_mat_0_normal; uniform float u_mat_0_alpha; uniform float u_mat_0_diff1; uniform float u_mat_0_diff2; uniform float u_mat_0_diff3; uniform float u_mat_0_spec1; uniform float u_mat_0_spec2; uniform float u_mat_0_spec3; uniform float u_mat_0_amb_fac; uniform float u_mat_0_emit; uniform int u_mat_0_hard; uniform light lights[2]; vec3 lambertdef(light l, vec3 vnormal, vec3 diff_color, float ref, float unused1, float unused2){ vec3 lightVec = normalize(l.loc - pos); return(max(dot(lightVec, vnormal), 0.0) * ref * vec3(l.color + vert_color) * diff_color); } vec3 lambertsun(light l, vec3 vnormal, vec3 diff_color, float ref, float unused1, float unused2){ vec3 lightVec = normalize(l.vec); return(max(dot(lightVec, vnormal) * ref * vec3(l.color + vert_color) * diff_color, 0.0)); }vec3 lamberthemi(light l, vec3 vnormal, vec3 diff_color, float ref){ vec3 lightVec = normalize(l.vec); return((0.5 * dot(lightVec, vnormal) + 0.5) * ref * vec3(l.color + vert_color) * diff_color); }vec3 lambertarea(light l, vec3 vnormal, vec3 diff_color, float ref, float unused1, float unused2){ vec3 lightVec = normalize(l.loc - pos); vec3 vect1, vect2, vect3, vect4; vec3 cross1, cross2, cross3, cross4; float rad[4]; float fac; vect1 = normalize(pos - vec3(l.mat[0][0], l.mat[0][1], l.mat[0][2])); vect2 = normalize(pos - vec3(l.mat[1][0], l.mat[1][1], l.mat[1][2])); vect3 = normalize(pos - vec3(l.mat[2][0], l.mat[2][1], l.mat[2][2])); vect4 = normalize(pos - vec3(l.mat[3][0], l.mat[3][1], l.mat[3][2])); cross1 = normalize(cross(vect1, vect2)); cross2 = normalize(cross(vect2, vect3)); cross3 = normalize(cross(vect3, vect4)); cross4 = normalize(cross(vect4, vect1)); rad[0] = dot(vect1, vect2); rad[1] = dot(vect2, vect3); rad[2] = dot(vect3, vect4); rad[3] = dot(vect4, vect1); rad[0] = acos(clamp(rad[0], -1.0, 1.0)) * (1 - floor(clamp(rad[0], 0.1, 1.0) + 0.00001)); rad[1] = acos(clamp(rad[1], -1.0, 1.0)) * (1 - floor(clamp(rad[1], 0.1, 1.0) + 0.00001)); rad[2] = acos(clamp(rad[2], -1.0, 1.0)) * (1 - floor(clamp(rad[2], 0.1, 1.0) + 0.00001)); rad[3] = acos(clamp(rad[3], -1.0, 1.0)) * (1 - floor(clamp(rad[3], 0.1, 1.0) + 0.00001)); fac = rad[0] * dot(vnormal, cross1); fac += rad[1] * dot(vnormal, cross2); fac += rad[2] * dot(vnormal, cross3); fac += rad[3] * dot(vnormal, cross4); fac = max(pow(-fac * l.areasize, l.k), 0.0); return(fac * ref * vec3(l.color + vert_color) * diff_color); } vec3 cooktorrdef(light l, vec3 vnormal, vec3 spec_color, float spec, float hard, float unused){ vec3 view = normalize(eye - pos); vec3 h = normalize((eye - pos) + (l.loc - pos)); float nh = max(dot(vnormal, h), 0.0); float nv = max(dot(vnormal, view), 0.0); return((spec * pow(nh, hard) * spec_color / (0.1 + nv)) * vec3(l.color + vert_color)); } vec3 cooktorrsun(light l, vec3 vnormal, vec3 spec_color, float spec, float hard, float unused){ vec3 view = normalize(eye - pos); vec3 h = normalize((eye - pos) + l.vec); float nh = max(dot(vnormal, h), 0.0); float nv = max(dot(vnormal, view), 0.0); return(spec * pow(nh, hard) * vec3(l.color + vert_color) * spec_color / (0.1 + nv)); } vec3 cooktorrhemi(light l, vec3 vnormal, vec3 spec_color, float spec, float hard){ vec3 view = normalize(eye - pos); vec3 h = normalize((eye - pos) + l.vec); float nh = 0.5 * (max(dot(vnormal, h), 0.0)) + 0.5; return(spec * nh * pow(nh, hard) * vec3(l.color + vert_color) * spec_color); } vec3 cooktorrarea(light l, vec3 vnormal, vec3 spec_color, float spec, float hard, float unused){ vec3 view = normalize(eye - pos); vec3 h = normalize((eye - pos) + (l.loc - pos)); float nh = max(dot(vnormal, h), 0.0); float nv = max(dot(vnormal, view), 0.0); return((spec * pow(nh, hard) * spec_color / (0.1 + nv)) * vec3(l.color + vert_color)); } float visibility_lamp(light l){ float visifac = 1.0; vec3 lv = (pos - l.loc); float dist = sqrt(dot(lv, lv)); visifac = l.dist / (l.dist + (l.att1 * dist)); visifac *= (l.dist * l.dist) / ( l.dist * l.dist + (l.att2 * dist * dist)); visifac = max(visifac * l.att3, l.dist / (l.dist + dist) * l.att4); float m = max(l.dist - dist, 0.0); return(visifac * max(m / l.dist, l.sphere)); } #define MATERIAL_ID 0 #define MATERIAL_FUNC material_0 vec3 MATERIAL_FUNC(inout vec3 diff_color, inout vec3 spec_color, inout vec3 normal, inout float alpha, float diff1, float diff2, float diff3, float spec1, float spec2, float spec3, float amb_fac, float emit, int hard){ vec3 diff_rslt = vec3(0.0, 0.0, 0.0); vec3 spec_rslt = vec3(0.0, 0.0, 0.0); vec3 amb_rslt = amb_color * amb_fac; float vis = 0.0; #define LIGHT_CALCULATIONS 1 #define LIGHT_ID 0 #define VISIBILITY visibility_lamp #define CALC_DIFFUSE 1 #define DIFF_SHADER_ID lambertdef #define CALC_SPECULAR 1 #define SPEC_SHADER_ID cooktorrdef #ifdef LIGHT_ID vis = VISIBILITY(lights[LIGHT_ID]); #endif #ifdef CALC_DIFFUSE #ifdef LIGHT_ID #ifdef HEMI diff_rslt+= amb_exp * (1.0 - exp(DIFF_SHADER_ID(lights[LIGHT_ID], normal, diff_color, diff1) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis * amb_range)); #else diff_rslt+= DIFF_SHADER_ID(lights[LIGHT_ID], normal, diff_color, diff1, diff2, diff3) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #endif #endif #endif #ifdef CALC_SPECULAR #ifdef LIGHT_ID #ifdef HEMI spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], normal, spec_color, spec1, hard) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #else spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], normal, spec_color, spec1, spec2, spec3) * lights[LIGHT_ID].layer * lights[LIGHT_ID].energy * vis; #endif #endif #endif #undef VISIBILITY #undef LIGHT_ID #undef CALC_DIFFUSE #undef CALC_SPECULAR #undef DIFF_SHADER_ID #undef SPEC_SHADER_ID #undef HEMI #ifdef LIGHT_CALCULATIONS return(amb_exp * (1.0 - exp(diff_rslt * amb_range)) + spec_rslt + amb_rslt); #else return(vec3(0.0, 0.0, 0.0)); #endif } #undef MATERIAL_ID #undef MATERIAL_FUNC void main(void){ vec3 norm = normalize(normal); vec3 diff_color = realcolor.xyz; vec3 spec_color = u_mat_0_spec_color; float alpha = realcolor.a; float diff1 = u_mat_0_diff1; float diff2 = u_mat_0_diff2; float diff3 = u_mat_0_diff3; float spec1 = u_mat_0_spec1; float spec2 = u_mat_0_spec2; float spec3 = u_mat_0_spec3; float amb_fac = u_mat_0_amb_fac; float emit = u_mat_0_emit; int hard = u_mat_0_hard; vec3 result = material_0(diff_color, spec_color, norm, alpha, diff1, diff2, diff3, spec1, spec2, spec3, amb_fac, emit, hard); gl_FragColor = vec4(result, alpha);} GLSL Program removed. GLSL MaterialTree removed. GLSL Material removed. GLSL GHash init GLSL Light removed. GLSL deactivated. GLSL GHash init GLSL activated. GLSL Material created. GLSL MaterialTree created. GLSL Program created. GLSL Shader code writing... GLSL Shader Compiled. Memoryblock free: pointer not in memlist Memoryblock free: pointer not in memlist GLSL Shader Compiled. Code: struct light{ vec3 loc; vec3 vec; vec3 color; float dist; float energy; float att1; float att2; float att3; float att4; float gamma; float area_x; float area_y; float sphere; float square; float area_type; float layer; mat4 mat; float areasize; float k; float spotsize; float spotblend; }; varying vec3 vert_color; varying vec3 normal, pos; varying vec4 realcolor; uniform vec3 eye; uniform vec3 amb_color; uniform float amb_exp, amb_range;uniform vec3 u_mat_0_diff_color; uniform vec3 u_mat_0_spec_color; uniform vec3 u_mat_0_normal; uniform float u_mat_0_alpha; uniform float u_mat_0_diff1; uniform float u_mat_0_diff2; uniform float u_mat_0_diff3; uniform float u_mat_0_spec1; uniform float u_mat_0_spec2; uniform float u_mat_0_spec3; uniform float u_mat_0_amb_fac; uniform float u_mat_0_emit; uniform int u_mat_0_hard; uniform light lights[2]; #define MATERIAL_ID 0 #define MATERIAL_FUNC material_0 vec3 MATERIAL_FUNC(inout vec3 diff_color, inout vec3 spec_color, inout vec3 normal, inout float alpha, float diff1, float diff2, float diff3, float spec1, float spec2, float spec3, float amb_fac, float emit, int hard){ vec3 diff_rslt = vec3(0.0, 0.0, 0.0); vec3 spec_rslt = vec3(0.0, 0.0, 0.0); vec3 amb_rslt = amb_color * amb_fac; float vis = 0.0; #define LIGHT_CALCULATIONS 1 #ifdef LIGHT_CALCULATIONS return(amb_exp * (1.0 - exp(diff_rslt * amb_range)) + spec_rslt + amb_rslt); #else return(vec3(0.0, 0.0, 0.0)); #endif } #undef MATERIAL_ID #undef MATERIAL_FUNC void main(void){ vec3 norm = normalize(normal); vec3 diff_color = realcolor.xyz; vec3 spec_color = u_mat_0_spec_color; float alpha = realcolor.a; float diff1 = u_mat_0_diff1; float diff2 = u_mat_0_diff2; float diff3 = u_mat_0_diff3; float spec1 = u_mat_0_spec1; float spec2 = u_mat_0_spec2; float spec3 = u_mat_0_spec3; float amb_fac = u_mat_0_amb_fac; float emit = u_mat_0_emit; int hard = u_mat_0_hard; vec3 result = material_0(diff_color, spec_color, norm, alpha, diff1, diff2, diff3, spec1, spec2, spec3, amb_fac, emit, hard); gl_FragColor = vec4(result, alpha);} GLSL Program linked.