Multiple Shaders


I wonder how do you work with multiple shader programs at the same time? I have a scene where there is a box and in it there are balls bouncing. I want to apply a program to walls and one to balls separately. How can I do that?


You create more than one program object. You call glUseProgram on the one for the box, then draw the box. Then call glUseProgram on the one for the balls, then draw the balls.

I exactly did that. But, somehow only one of the programs is working. I only get the texture for the walls and I do not see the lighting for the balls. Both programs are working fine when used individually.