# Using different interpolation

Hi all!
I have some rectangle and 4 color for each top.
I have to fill the rectangle using different interpolation.
How can i set different interpolation in OpenGl.

I don’t understand what you mean with ‘different’ interpolation, but if you want to interpolate the colors at the corners of your rectangle you can use glShadeModel(GL_SMOOTH);

Hope that helps…

Hi!
But, have OpenGl anather interpolation?
Thx!!!

No, with glShadeModel(GL_SMOOTH) the colors will be linearly interpolated.

Bilinear (and trilinear) interpolation is something different and is usually only used as a texture filter, not for interpolating vertex colors.

Bi/trilinear interpolation is nothing special to texture filtering. Bi and Tri just refers to the amount of interpolation factors used.

Bilinear interpolation is a linear interpolation with two (bi-linear) interpolation factors. If you interpolate the color linearly on a triangle, you must use two interpolation factors, and it must therefore be a bilinear interpolation.

Bilinear texture filtering is when you have two interpolation factors to blend adjacend texels, up/down and left/right. Trilinear texture filtering is when you have three interpolation factors, up/down, left/right, and between two mipmap levels.

Anyways, you can’t affect the way the colors are interpolated, other than saying flat or smooth shading.

Bilinear interpolation is a linear interpolation with two (bi-linear) interpolation factors. If you interpolate the color linearly on a triangle, you must use two interpolation factors, and it must therefore be a bilinear interpolation.

Actually, that is not accurate. Single Linear interpolation interpoates linearly between two endpoints. Linear interpolation creates a line, and is 1-Dimensional

Bilinear interpolation is 2-dimensional. That’s why you see it in 2D texture-filtering. Bilinear interpolates between 4 different values.

Trilinear interpolation is 3-dimensional, interpolating between 8 values.

Originally posted by Bob:
Bi/trilinear interpolation is nothing special to texture filtering. Bi and Tri just refers to the amount of interpolation factors used.

Actually, I didn’t say it’s special to texture filtering and interpolation between 2 attributes is not bilinear, like Korval already said…

I didn’t say bilinear interpolation is interpolation between two values, but interpolation using two interpolation factors. Thats a different thing.

Richardve, this is what you said.

Bilinear (and trilinear) interpolation is something different and is usually only used as a texture filter, not for interpolating vertex colors.

Yes, bilinear interpolation is used for vertex colors, since you must interpolate the vertex color in two dimensions, therefore using two interpolation factors, one for each dimension. A surface is a two dimensional object.

…and is usually only used as a texture filter…

That was the part that I interpretated as, “special for texturing”, by the way.

Oh well, blame it my sucky English…