Thursday, October 31, 2013

I seriously don't understand shaders

Quite honestly, I don't understand shaders, or more specifically, the vertex shader. If all it's purpose is to take in an outside coordinate and basically process it, why do we need it? For example, here is the most basic vertex shader you can use (it even uses old deprecated code, making it even simpler than the new core profile):

void main(){
gl_Position = ftransform();
} 

All this shader does is take in a coordinate using a glVertex#f call or drawElement call etc... and supposedly translates the geometry around to where it needs to be. But that is already done in the actual code, so why do I need a shader to do that for me? I can't even just use the shader and never call a draw method upon my vertices in OpenGL, its just not possible. The fragment shader makes more sense to me, however, because you can do all sorts of amazing things you could never do with the fixed function pipeline. You can create lighting effects, blur textures, change the colors of textures super easy; all this great stuff. So I understand the use of the fragment shader, but why a vertex shader? I, as of right now, see no need for one.

 Maybe I'm just an idiot though!

No comments:

Post a Comment