public void setSpotLight ( int i , Color color , boolean enableColor , Vector3D v , float nx , float ny , float nz , float angle ) { float spotColor [ ] = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; float pos [ ] = { ( float ) v . getX ( ) , ( float ) v . getY ( ) , ( float ) v . getZ ( ) , 0.0f } ; float direction [ ] = { nx , ny , nz } ; float a [ ] = { angle } ; gl . glEnable ( GL2 . GL_LIGHTING ) ; gl . glEnable ( GL2 . GL_LIGHT0 + i ) ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_POSITION , pos , 0 ) ; if ( enableColor ) gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_DIFFUSE , spotColor , 0 ) ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_SPOT_DIRECTION , direction , 0 ) ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_SPOT_CUTOFF , a , 0 ) ; }
Sets the color value position direction and the angle of the spotlight cone of the No . i spotLight