c - too much specular light opengl -


these settings diffuse,ambient , specualar , position of light. scene looks extremly lit specualar light. have tried adjusting position of light doesn't anything. glfloat greendiffusematerial[] = {0.0, 1.0, 0.0,1.0}; glfloat whitespecularmaterial[] = {1.0, 1.0, 1.0,1.0}; glfloat greenambientmaterial[] = {0.0, 1.0, 0.2,1.0};

glfloat greenemissivematerial[] = {0.0, 1.0, 0.5,1.0}; glfloat lightposition[] = { 0.0,1.0,0.0, 0.0}; glfloat ambientlight[]  = { 0.0, 0.0, 0.0, 1.0 }; glfloat diffuselight[]  = { 1.0, 1.0, 1.0, 1.0 }; glfloat specularlight[] = { 1.0, 1.0, 1.0, 1.0 }; 

edit 1

 (int g =0;g<6400;g++){     glbegin(gl_quads);         if(mounttext %2 ==0){gltexcoord2f(islandvert[g][0] /xscale,islandvert[g][2] / zscale);}         else{                 glenable(gl_normalize);         gldisable(gl_texture_2d);         glshademodel(gl_smooth);         glenable(gl_color_material);         glenable(gl_depth_test);                         glmaterialfv(gl_front_and_back, gl_ambient, greenambientmaterial);                         glmaterialfv(gl_front_and_back, gl_diffuse, greendiffusematerial);                         glmaterialfv(gl_front_and_back, gl_specular, whitespecularmaterial);                         glmaterialfv(gl_front_and_back, gl_shininess, mshininess);                             glcolormaterial(gl_front_and_back, gl_diffuse);                             glcolormaterial(gl_front_and_back, gl_ambient);                         glcolormaterial(gl_front_and_back, gl_specular);                     glpolygonmode(gl_front_and_back, gl_fill);}         glnormal3f(vertnorm[g][0],vertnorm[g][1],vertnorm[g][2]);          glvertex3f(islandvert[g][0],islandvert[g][1],islandvert[g][2]);         g++;         if(mounttext %2 ==0){gltexcoord2f(islandvert[g][0] / xscale, islandvert[g][2] / zscale);}         else{             glenable(gl_normalize);         gldisable(gl_texture_2d);         glshademodel(gl_smooth);         glenable(gl_color_material);         glenable(gl_depth_test);         glmaterialfv(gl_front_and_back, gl_specular, whitespecularmaterial);                         glmaterialfv(gl_front_and_back, gl_ambient, greenambientmaterial);                         glmaterialfv(gl_front_and_back, gl_diffuse, greendiffusematerial);                         glmaterialfv(gl_front_and_back, gl_shininess, mshininess);                             glcolormaterial(gl_front_and_back, gl_diffuse);                             glcolormaterial(gl_front_and_back, gl_ambient);                             glcolormaterial(gl_front_and_back, gl_specular);                     glpolygonmode(gl_front_and_back, gl_fill);}         glnormal3f(vertnorm[g][0],vertnorm[g][1],vertnorm[g][2]);         glvertex3f(islandvert[g][0],islandvert[g][1],islandvert[g][2]);         g++;          if(mounttext %2 ==0){gltexcoord2f(islandvert[g][0] / xscale, islandvert[g][2] / zscale);}         else{                 glenable(gl_normalize);         gldisable(gl_texture_2d);         glshademodel(gl_smooth);         glenable(gl_color_material);         glenable(gl_depth_test);                         glmaterialfv(gl_front_and_back, gl_ambient, greenambientmaterial);                         glmaterialfv(gl_front_and_back, gl_diffuse, greendiffusematerial);                         glmaterialfv(gl_front_and_back, gl_specular, whitespecularmaterial);                         glmaterialfv(gl_front_and_back, gl_shininess, mshininess);                             glcolormaterial(gl_front_and_back, gl_diffuse);                             glcolormaterial(gl_front_and_back, gl_ambient);                             glcolormaterial(gl_front_and_back, gl_specular);                                         glpolygonmode(gl_front_and_back, gl_fill);}         glnormal3f(vertnorm[g][0],vertnorm[g][1],vertnorm[g][2]);         glvertex3f(islandvert[g][0],islandvert[g][1],islandvert[g][2]);          g++;          if(mounttext %2 ==0){gltexcoord2f(islandvert[g][0] / xscale, islandvert[g][2] / zscale);}         else{                 glenable(gl_normalize);         gldisable(gl_texture_2d);         glshademodel(gl_smooth);         glenable(gl_color_material);         glenable(gl_depth_test);                         glmaterialfv(gl_front_and_back, gl_ambient, greenambientmaterial);                         glmaterialfv(gl_front_and_back, gl_diffuse, greendiffusematerial);                         glmaterialfv(gl_front_and_back, gl_specular, whitespecularmaterial);                         glmaterialfv(gl_front_and_back, gl_shininess, mshininess);                             glcolormaterial(gl_front_and_back, gl_diffuse);                             glcolormaterial(gl_front_and_back, gl_ambient);                             glcolormaterial(gl_front_and_back, gl_specular);                     glpolygonmode(gl_front_and_back, gl_fill);}         glnormal3f(vertnorm[g][0],vertnorm[g][1],vertnorm[g][2]);         glvertex3f(islandvert[g][0],islandvert[g][1],islandvert[g][2]);     glend(); } 

basiclly @ each cordinate check if texture on or not , if it's not want set original green material. result i'm getting 1 side of object extremly lit , other side ambient. vertex normals work because there smooth shading think might have position of light. when try change scene remains same.

this part alone

glfloat greenemissivematerial[] = {0.0, 1.0, 0.5,1.0}; 

will make object appear in color (0, 1, 0.5) independent of light source specify. real lighting add color, making brighter.


Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -