shader Confusion

Started by
2 comments, last by NineYearCycle 19 years, 7 months ago
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?
------------ "Here lies a toppled God,His fall was not a small one,We but built his pedastle,A narrow, and a tall one" Frank Herbert (Dune:Messiah)
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).
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?
------------ "Here lies a toppled God,His fall was not a small one,We but built his pedastle,A narrow, and a tall one" Frank Herbert (Dune:Messiah)
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

"Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile"

"Life is short, [the] craft long, opportunity fleeting, experiment treacherous, judgement difficult."

This topic is closed to new replies.

Advertisement