Original Post
So, I've been reading up on shaders, and even ran a simple test program with shaders. I know how to write one (the basics), how to load the shaders and use them. However, the shaders apply to everything you draw. That is my problem. I want in my library people to be able to set a shader per object. I would probably make a shader class, holding the pointers to the shader in VRAM. However, how would I switch a shader on and off? It would only be used for one object at a time, and the next object could be an entirely different shader. So I should put a shader on, draw the object, and switch it off. How would I do this? What functions are used for this? And how bad is the overhead of switching (like with switching textures?)? Thanks!