dbf-halloween2015
diff src/light.cc @ 0:50683c78264e
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 01 Nov 2015 00:09:12 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/light.cc Sun Nov 01 00:09:12 2015 +0200 1.3 @@ -0,0 +1,17 @@ 1.4 +#include "light.h" 1.5 +#include "opengl.h" 1.6 + 1.7 +Light::Light() 1.8 + : color(1, 1, 1) 1.9 +{ 1.10 +} 1.11 + 1.12 +void Light::setup(int idx) const 1.13 +{ 1.14 + float lpos[] = {pos.x, pos.y, pos.z, 1.0}; 1.15 + float col[] = {color.x, color.y, color.z, 1.0}; 1.16 + 1.17 + glLightfv(GL_LIGHT0 + idx, GL_POSITION, lpos); 1.18 + glLightfv(GL_LIGHT0 + idx, GL_DIFFUSE, col); 1.19 + glLightfv(GL_LIGHT0 + idx, GL_SPECULAR, col); 1.20 +}