** Light.h ** #include // Header File For The Windows Library #include // Header File For Standard Input/Output #include // Header File For The OpenGL32 Library #include // Header File For The GLu32 Library #include // Header File For The GLaux Library class Light { public: Light(); ~Light(); void switchLight(BOOL); void init(void); private: BOOL light; // Lighting ON / OFF BOOL lp; // L Pressed? GLfloat LightAmbient[4]; GLfloat LightDiffuse[4]; GLfloat LightPosition[4]; }; ** Light.cpp ** #include "Light.h" Light::Light() { LightAmbient = { 0.5f, 0.5f, 0.5f, 1.0f }; LightDiffuse = { 1.0f, 1.0f, 1.0f, 1.0f }; LightPosition = { 0.0f, 1.0f, 2.0f, 1.0f }; glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); // Setup The Ambient Light glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light glEnable(GL_LIGHT1); // Enable Light One } Light::~Light() { } void Light::switchLight(BOOL lp) { if (!Light::lp && lp) { lp=TRUE; light=!light; if (!light) { glDisable(GL_LIGHTING); } else { glEnable(GL_LIGHTING); } } Light::lp = lp; }