Skip to content

Instantly share code, notes, and snippets.

@obviousjim
Created August 9, 2013 11:30
Show Gist options
  • Save obviousjim/6192938 to your computer and use it in GitHub Desktop.
Save obviousjim/6192938 to your computer and use it in GitHub Desktop.
ofLight/ofShader/ofMaterial custom shader potential
cpp
ofLight myLight;
ofEnableLight();
myLight.begin(); --> registers the light with the ofGLRenderer
myShader.begin(); --> register the shader with ofGLRrenderer, which then passing all enabled lights to it as a uniform
myMaterial.begin(); --> registers
drawSomething()
myMaterial.end();
myShader.end();
myLight.end();
shaderbegin(){
glRenderer.setActiveShader(this);
}
glsl
#vertex
#of_use_lights //imports all uniforms
void main(){
vec3 lightColor = ofLightValu();
//calculate view direction based on normal
//constants, based
//sets
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment