Jump to content
  • Advertisement
Sign in to follow this  

shader Confusion

This topic is 4993 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am pretty confused as to what shaders are. I know that a vertex shader changes things about a vertex and a pixel shader.... But i do not understand how they are added to a program. I read somewhere that they effect all verticies. But dosnt that mean that u can only use that one shader in ur program,and nothing else. help?

Share this post


Link to post
Share on other sites
Advertisement
Basically a vertex shader is a short program for which vertexes are passed, you can then alter these vertexes in the program and you output your altered version of them. Pixel shaders are the same apart from you're processing fragments (which is basically a potential pixel contaning data such as texture coordinates as well as a colour value).

When using shaders they are only applied when bound. E.g. you may have a pixel and vertex shader for drawing a bumpmapped surface, and a pixel and vertex shader for drawing a water surface. When you draw what you want to be bumpmapped you'd bind the shaders that do bumpmapping. When drawing your water surface you'd bind the shaders that do the effects for your water surface (e.g. reflection of the surrounding scene).

Share this post


Link to post
Share on other sites
ahh, i see.
So u us them by using something simmilar to glBindTexture();

Butwhen u are done using shaders. How would you revert back to normal drawing?

Share this post


Link to post
Share on other sites
You dont revert back to "normal drawing", you use shaders OR the Fixed Function Pipeline (FFP), you dont mix them as there is no need.

You can do anything in a shader that the FFP can do, and many things that the FFP can't do.

If all you want to do is apply a matrix transformation to view an object, like your "normal drawing", then that is done inside a shader that only does that.

Andy

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!