Render different shapes with different shaders

edited April 2014 in GLSL / Shaders

Is there a way to have different shaders for different shapes? Or does any shader apply to any rendered shape?

Tagged:

Answers

  • a shader is applied to all subsequent shapes until a new shader is set, or the default shader is re-enabled with resetShader():

    shader(sh1);
    shape(obj1); 
    shader(sh2);
    shape(obj2);
    resetShader();
    shape(obj3);
    

    shader sh1 will render shape obj1, sh2 will render obj2, and the default shader will render obj3.

Sign In or Register to comment.