Sign in to follow this  
MattHughes

multiple GLSL shaders (images!)

Recommended Posts

Hello, I'm starting to understand the basics of GLSL and have been toying around with it all afternoon. What I don't understand is how to specify which shader is being used on a certain object. For example, I have this colorful vertex shader: I also have this mediocre toon fragment shader: What would I do if I want the monkey to render with the toon shader, and the human with the colorful shader? Every tutorial that I've found has assumed that I want a shader to apply to the entire scene.

Share this post


Link to post
Share on other sites
When you will render an object, the call sequence might look something like

for all objects;
glBindTexture(...) //Texture
glUseProgram(...) //Shader
glUniform4fv(....) //Uniforms
glBindBuffer(...) //VBO
glVertexPointer(...) //VBO offsets
glBindBuffer(...) //IBO
glDrawRangeElements(....)
repeat;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this