Has anyone here ever had intermittent problems with lighting? I’ve written a small demo of a few balls spinning around, and occasionally a frame will either become extremely bright (the objects become almost completely white), or really dark. The balls are being drawn using gluSphere() with material properties set using glMaterialfv(). I have ruled out several possible problems:
i) The normals are correct - after all, they are generated by gl.
ii) I’m not incorrectly using the GL_PROJECTION matrix mode to set the camera position.
iii) I don’t use glScalef(), so I don’t think the normals are being stretched. I tried enabling GL_NORMALIZE, but this did not help.
The worrying thing is that the problem is intermittent, and I can’t think of any reason it does not occur every frame. This also happens on several different machines running different OS’s (win9x, 2k, and xp).
Any suggestions?
Jimmi
p.s. I have read immy’s post on the advanced board, which may be a similar problem, but did not find a solution there.
did u read the faq?, lots of advice there
perhaps youre not updating the lights position after every time u position the ‘camera’
if the sphere is the same colour overall ie all black,all grey,all white. then u are supplying differnt normals for each vertice
gluQuadricOrientation and gluQuadricNormals() define the direction of the generated normals (inside or outside) and how they are shaded (smooth, flat etc.). In this case you don’t need to specify your own normals using glNormal3f() because the quadric object generates them for you.
Hi Zed,
I don’t think that is the problem I set up my lights every time I render (although I shouldn’t - inefficient ). The spheres may appear very dark or bright, but they are certainly being shaded. I might put a website up with examples.
jimmi
[This message has been edited by jimmi (edited 04-22-2002).]
I’ve put up examples of the problem at www.dcs.shef.ac.uk/~jedge/temp.html I should reiterate that the problem is intermittent - most of the frames are shaded normally, but occaisionally a frame is shaded extremely bright or dark. The only thing I do between frames is change the positions of the objects (rotate them around the origin) or change the manner in which they are shaded (flat/smooth, point/line/fill). After a couple of frames the object will return to normal shading.
jimmi
[This message has been edited by jimmi (edited 04-22-2002).]
What kind of lights are you using, what are their positions and other properties? Directional or positional lights? What attenuation parameters?
The highlights on the spheres seem to indicate multiple lights (otherwise i would expect the highlights to be elsewhere: the highlight on a sphere on the left side of the image should be more to the right than the highlight on a sphere on the right side of the image).