Problem with lighting after rendering Cylinder

Started by bobbie12, April 11, 2013, 11:48:07

Previous topic - Next topic

bobbie12

Hello, already tried everything and cann't find reason why after rendering Cylinder whole lighting system is not working.
World I'm rendering is full of quads and triangles and work perfect till I'm not trying to add Cylinder into it.
I'm using LWJGL library - org.lwjgl.util.glu.Cylinder - for rendering cylinder.
Cylinder c = new Cylinder();
c.setTextureFlag(true);
glBindTexture(GL_TEXTURE_2D, textureID);
c.draw(baseRadius, topRadius, height, slices, stacks); - (when this line is commented all works great).
After drawing cylinder all elements get darker, and no mater how far i move camera cylinder is highlighted.

Fool Running

Best guess without seeing the rest of your code is that you are using lighting, but don't define any normals for your objects. When calling Cylinder.draw() OpenGL remembers the last normal that was used in the creation of the cylinder and that becomes the normal that is used for all of your objects. This new normal is probably pointing away from the light which makes everything appear dark.

You can most likely fix the problem by defining the correct normals for the rest of your objects.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D