Skip to content

Instantly share code, notes, and snippets.

@cyrstem
Created November 6, 2018 20:50
Show Gist options
  • Save cyrstem/15835728aae9d2bc3fa26ec35cbfc159 to your computer and use it in GitHub Desktop.
Save cyrstem/15835728aae9d2bc3fa26ec35cbfc159 to your computer and use it in GitHub Desktop.
// setup lights
ofSetSmoothLighting(true); // nicer lighting rendering
// setup point light
light.setPointLight();
light.setPosition(0, 0, 200);
light.setDiffuseColor( ofColor::white );
light.setAttenuation(.5); // adjust the light throw
// setup spot light
spotlight.setSpotlight();
spotlight.setPosition(300, 0, 0);
spotlight.lookAt(sphere);
spotlight.setDiffuseColor( ofColor::blue );
light.setSpecularColor( ofColor::fuchsia );
draw()
ofEnableLighting(); // turn on lighting globally
ofEnableDepthTest(); // render objects in order of depth
light.enable(); // enable our lights
spotlight.enable();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment