View Full Version : about Texture Coordinate

06-25-2006, 08:26 PM
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?

06-25-2006, 08:33 PM
The TexCoord 64/64 is the Border of the Texture,isn't it?

06-26-2006, 12:45 AM
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 (N+0.5)/texture_size. That will give you an unfiltered sample of that texel even if GL_LINEAR filtermode is set.

06-26-2006, 02:03 AM
Thank you

06-26-2006, 04:22 AM
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.

06-26-2006, 05:21 AM
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.

06-26-2006, 05:51 AM
Ok, I take that back. ;) 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.

06-26-2006, 06:23 AM
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 ;)

06-28-2006, 09:46 PM
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."

06-28-2006, 10:56 PM
Relic, I use the nearest, but it does not look well.there should be another way.

06-29-2006, 04:26 AM
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... )