Does anybody know if you can disable the texture interpolation in the rasterizer before the fragment goes to the fragment shader?
What I would like to do is have a quad in world coordinate with each vertex having four texture coordinates attached to it. The four texture coordinates are the four vertices of the quad. I would like to have that information in the fragment shader.
Let’s assume you can disable interpolation. You have triangle with 3 vertices. One defines texture coordinate as (0.0, 0.0), second as (1.0, 0.0) and third as (1.0, 1.0). What’s the texture coordinate at center of polygon? Undefined?
This is why you cannot disable interpolation - it just makes no sense.
If you need some texture coordinate to be constant across polygon then you must make it equal at all it’s vertices.
I want to use the texcoord for a different purpose in the fragment shader so I am not interest in knowing the texture coordinate at the center.
I was wondering if there is a way to disable texture interpolation as you can do using GL_FLAT for colors.
Assign the same texture coordinates to all vertices and you will have the interpolation effectively disabled.
Use multitexturing (the texcoord part of it).
With it you can define multiple coordinates for all vertices.
You can do this with GL_NV_gpu_program4 or GL_EXT_gpu_shader4. They expose flat, centroid, and noperspective (not perspectively corrected) in addition to the normal linear interpolation.