View Full Version : Is there a way to disable texture coordinate interpolation?

02-20-2007, 04:04 AM
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.



02-20-2007, 06:53 AM
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.

02-20-2007, 07:17 AM
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.


02-20-2007, 08:17 AM
Assign the same texture coordinates to all vertices and you will have the interpolation effectively disabled.

02-20-2007, 08:19 AM
Use multitexturing (the texcoord part of it).
With it you can define multiple coordinates for all vertices.

02-20-2007, 11:01 AM
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.


02-22-2007, 08:00 AM
Thanks that info helps.