I compute some values in the vertex shader and then ,depending on their values, do some operations in the fragment shader. How can I pass this values/information, if it’s not the normal parameters (color, position, texture, etc…)?
you have to create a global variable with the qualifier “varying”. It must be the same declaration in your vertex shader and in the fragment shader. Data between vertex and fragment shader are interpolated thanks to this.
Can I really do that in ARB program? Or do I have to use a special language or packages?
Using varying variables or passing things directly as texture coordinates.
gl_TexCoord = stuffToPass;
vec4 passedStuff = gl_TexCoord
MOV result.texcoord, stuffToPass;
MOV passedStuff, fragment.texcoord;
Texture coordinates do not have to be used for textures. They’re just a 4-vector floating-point value that gets linearly interpolated (perspectively-correct) across the surface of a triangle.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.