Skip to main content
GameDev.net gamedev.net
🔒 Locked

OpenGL lighting problems

Started by chronozphere Nov 20, 2009 at 6:43 AM 0 replies 750+ views
Original Post
chronozphere
chronozphere
Hi there, I want to setup a light in such a way that it's intensity does not decay over distance. I'm using the following parameters now:

  >> Light parameters (GL_LIGHT0):
  Ambient = (0, 0, 0, 255)
  Diffuse = (255, 255, 255, 255)
  Specular = (255, 255, 255, 255)

  Attenuation_constant = 1
  Attenuation_linear   = 0
  Attenuation_quadratic = 0

  >> Scene
  Ambient = (0, 0, 0, 255)

  I also used this call:
  
  glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);

  and I've set the color (glColor4ub) to (255, 255, 255, 255) before rendering.   
I made this light and let it rotate around my model. The polygons of my model are either white or black (no gray's). This is weird because the angle between the light vector and the surface normal should cause the colors to slowly fade instead of flicker from black to white. My normals should be okay. I suspect something else is wrong.. Can someone help me? Thanks in advance. =)
chronozphere
chronozphere
I was using glScale to transform my model. This also ruins my normals. GL_RESCALE_NORMAL or GL_NORMALIZE are sollutions to this problem. =D

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.