Newish to GLSL & 2 pcs different results?

Hi, i am wanting to learn to use shaders and so worked threw some tutorials on my laptop and got some per pixel lighting working, i then tryed to do the same with material properties including specular and shineness and couldnt get it working as i thought it should, i presumed it was my code and rattled my brains for a while. I game up and moved to my PC which is kinda of gaming dedicated with an ATI 5700 series and it seems that the shineyness works and the object is now lit?

Is this simply down to graphics adapter? Does it not support specular materials or somthing? The laptop graphics adapter is
a Intel GMA X3100, which apparently has PS4.0 support?

Thanks
Andy

What is the graphic hardware of your laptop ? EDIT: intel is well know for its weak hardware but also for very shitty drivers. Do you have recent drivers ?

Can you post your shaders ?

Yeaaa, i also thought that, but didnt think this was too harder a task for it! lol. Yes sure, the shaders for my Per pixel lighting with materials are as follows:

Vert Shader


varying vec3 vertex_light_position;
varying vec3 vertex_light_half_vector;
varying vec3 vertex_normal;

void main()

{            
    vertex_normal = normalize(gl_NormalMatrix * gl_Normal);

    vertex_light_position = normalize(gl_LightSource[0].position.xyz);

    vertex_light_half_vector = normalize(gl_LightSource[0].halfVector.xyz);

    gl_FrontColor = gl_Color;

    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
} 
 

Pixel Shader

  
varying vec3 vertex_light_position;
varying vec3 vertex_light_half_vector;
varying vec3 vertex_normal;

void main() 
{
    vec4 ambient_color = gl_FrontMaterial.ambient * gl_LightSource[0].ambient + gl_LightModel.ambient * gl_FrontMaterial.ambient;

    vec4 diffuse_color = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;

    vec4 specular_color = gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(max(dot(vertex_normal,vertex_light_half_vector), 0.0) , gl_FrontMaterial.shininess);
 
    float diffuse_value = max(dot(vertex_normal, vertex_light_position), 0.0);

    gl_FragColor = ambient_color + diffuse_color * diffuse_value + specular_color;

}
 

Thanks
Andy

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.