LWJGL Forum

Programming => OpenGL => Topic started by: bobbie12 on April 11, 2013, 11:48:07

Title: Problem with lighting after rendering Cylinder
Post by: bobbie12 on April 11, 2013, 11:48:07
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.
Title: Re: Problem with lighting after rendering Cylinder
Post by: Fool Running on April 11, 2013, 12:56:10
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.