about Texture Coordinate

The range of the Texture Coordinate is from 0.0 to 1.0. Now I have 64 points.And each points have his own color. Then I have 64 different colors.Use these colors to build a 1D Texture.The problem comes out.The TexCoord is from 0/64 to 64/64,which have 65 points.How to match 65 TexCoords to 64 Points?

The TexCoord 64/64 is the Border of the Texture,isn’t it?

Accessing a texture at coordinate N/texture_size (N is an integer indicating the texel index) gives you the border between texels N-1 and N. The texel center for texel N is located on i/texture_size[/i]. That will give you an unfiltered sample of that texel even if GL_LINEAR filtermode is set.

Thank you


That will give you an unfiltered sample of that texel even if GL_LINEAR filtermode is set.

Nope.
You need to have GL_NEAREST filtering to disable linear filtering.

Aehm… If you lookup into the texture at exactly the center of a texel, you’ll always get the unfiltered sample, even with linear filtering.

Ok, I take that back. :wink: For alpha and beta == 0.5 the only term remaining in OpenGL 2.0 spec figure 3.10 on page 158 and formula (3.26) on page 174 is tau(i0,j0).
Though the recommendation is to use nearest filtering if you want purely unfiltered lookups from a texture due to unknown floating point accuracy in the interpolations.

Formula 3.26:
r = (1 - alpha) * Ti0 + alpha * Ti1
so if alpha = 0
r = Ti0
We only need to specify texture coordinate that generates alpha = 0

Just above formula 3.26 we see that:
alpha = frac(u - 1/2)

so if you specify u = 0.5 then:
alpha = frac(0.5 - 0.5) = 0

So I think Overmind is right this time. Besides, my HDR rendering is based on such understanding of these formulas and it works perfectly :wink:

well, Thank all. The reason why I post this Topic is that I want to find a way to deal with the Brick boundary’s problem. Relic,you know that I use Brick’s to build large Volume.Then each Brick boundary seems not smooth.I think whether I can use border of Texture to deal with these. I find some information from the pdf file klaus given me. But I can’t understand well about this"By repeating one voxel of brick 1 at the brick boundary in brick 2."

Relic, I use the nearest, but it does not look well.there should be another way.

Ah, you have arrived at the rendering complications I predicted.
Well, you got one answer about texture borders to get steady filtering across bricks in another thread. That should work.

(k_szczech: Yes, I meant u and v instead of alpha and beta, elimination happens with alpha and beta == 0.0 of course. Doh, I need some vacation… )