Reputation: 43
This program currently loads .obj files and has a small collision system. I also went about testing some seamless ground. Now to the issue as depicted here.
There is one spot on the "ground" that just reflects the light I have above it. I don't know if this is an issue with the light or the material loaded via the .obj file. The code for the light is:
float col[]={1.0,1.0,1.0,1.0};
float col1[]={0.3,0.3,0.3,1.0};
float col2[]={0.8,0.8,0.8,1.0};
float pos[]={0.0,10.0,0.0, 1.0};
float spotDir[] ={0.0, -1.0, 0.0};
glLightfv(GL_LIGHT0,GL_DIFFUSE,col2);
glLightfv(GL_LIGHT0, GL_AMBIENT, col1);
glLightfv(GL_LIGHT0, GL_SPECULAR, col);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, spotDir);
glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 90.0);
The one lit spot also moves with the camera depending which angle you look at it from. The other issue is the edges of the cube on unlit sides show what looks like tearing but I have no idea what causes it, again I think it is a lighting issue.
Any ideas on how to get rid of this?
Upvotes: 1
Views: 199
Reputation: 39370
That looks like a specular highlight. Just zero your specular color and you're done.
And that's how light works in the real world, by the way.
Upvotes: 1