Reputation: 43
I'm using OpenTK for C#. I'm kinda new to graphics programming.
Is there a way to pass an attribute directly to the fragment shader and skip the vertex shader?
It'd be useful when working with uvs. I want to pass the uv to the fragment shader because I change nothing in the vertex shader.
Upvotes: 4
Views: 2777
Reputation: 210878
You can't. The vertex shader is executed once per vertex coordinate, the fragment shader is executed per fragment (even more for multisampling). The outputs of the vertex shader are interpolated for the fragments which are covered by a primitive. The interpolated values (coordinates) are the inputs to the fragment shader (if the fragment shader stage directly follows the vertex shader).
You need to specify which attribute is an output from the vertex shader and ultimately an input to the fragment shader. This is done by an assignment in the vertex shader.
Upvotes: 5