public void setLightAttenuation ( int i , float constant , float liner , float quadratic ) { float c [ ] = { constant } ; float l [ ] = { liner } ; float q [ ] = { quadratic } ; gl . glEnable ( GL2 . GL_LIGHTING ) ; gl . glEnable ( GL2 . GL_LIGHT0 + i ) ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_CONSTANT_ATTENUATION , c , 0 ) ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_LINEAR_ATTENUATION , l , 0 ) ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_QUADRATIC_ATTENUATION , q , 0 ) ; }
Set attenuation rates for point lights spot lights and ambient lights .