TSorcerer
11-20-2008, 01:38 AM
Hi,
I'm currently working at implementing lighting into my OpenGL program. Currently I draw a Sphere, loaded from a 3ds file, to my scene. To enable lightning I calculate Normals for each of the sphere's faces after loading it from the file. I then added to my draw method the glNormal3fv command that defines each faces normal using the calculated valeus from when I loaded the sphere.
When running the program I see my sphere lit up by light. However, the lighting looks odd, so I switched it off again and watched my sphere without lighting, but still issueing the glNormal command while drawing the sphere. And then following happened:
Screenshots (http://img252.imageshack.us/img252/7610/flickergb1.jpg)
The sphere is flickering. It looks like if the "fractured" part gets bigger and bigger until filling all of the sphere at which it suddenly disappears and will begin to grow again.
When I remove the glNormal part the sphere will draw fine again.
To figure out what's going on, I added a small routine, that should draw me each of the face's normals. Maybe they're pointing in the wrong direction or something?
However, when I draw the normals they show fine pointing out of the sphere.
However, when I load another mesh (just some random polygons scattered around) and draw them instead or together with the sphere, it does not flicker.
Only the sphere is mocking. I compared the number of vertices and faces loaded from the file for the sphere and it equals to the number Blender shows me.
I don't have any idea why the sphere is flickering, maybe someone here has an idea?
Greets,
Daniel
I'm currently working at implementing lighting into my OpenGL program. Currently I draw a Sphere, loaded from a 3ds file, to my scene. To enable lightning I calculate Normals for each of the sphere's faces after loading it from the file. I then added to my draw method the glNormal3fv command that defines each faces normal using the calculated valeus from when I loaded the sphere.
When running the program I see my sphere lit up by light. However, the lighting looks odd, so I switched it off again and watched my sphere without lighting, but still issueing the glNormal command while drawing the sphere. And then following happened:
Screenshots (http://img252.imageshack.us/img252/7610/flickergb1.jpg)
The sphere is flickering. It looks like if the "fractured" part gets bigger and bigger until filling all of the sphere at which it suddenly disappears and will begin to grow again.
When I remove the glNormal part the sphere will draw fine again.
To figure out what's going on, I added a small routine, that should draw me each of the face's normals. Maybe they're pointing in the wrong direction or something?
However, when I draw the normals they show fine pointing out of the sphere.
However, when I load another mesh (just some random polygons scattered around) and draw them instead or together with the sphere, it does not flicker.
Only the sphere is mocking. I compared the number of vertices and faces loaded from the file for the sphere and it equals to the number Blender shows me.
I don't have any idea why the sphere is flickering, maybe someone here has an idea?
Greets,
Daniel