Hi,
I have to fetch data from my texture images using texture coordinates. Does anyone here know how to fetch data from texture images using texture coordinates. Here is what I really intend to do:
I create a NPOT floating-point texture like TexA:
TexA:
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
So, this TexA is 4x4. I am aware that in OpenGL texture coordinates are central pixel values, I mean like (0.5, 0.5)…(3.5, 3.5). So, I want to write a program which computes these texture coordinates values and when passed to the texture image behaves like:
(0.5, 0.5) fetches 0.
(0.5, 1.5) fetches 1.
(0.5, 2.5) fetches 2.
…
(3,5, 2.5) fetches 14.
(3.5, 3.5) fetches 15.
Please help me to create this program. I would appreciate if someone could pass their code if they have already done so.
Thanks.