2d menu texturing
for a 2d menu i use ortogonal rendered planes
so i could place them with pixel coodinates on screen.
because this planes must match exactly with the background
the texture must mapped with no scale. Now comes the
difficult part, because the texture images must have
a size which is power of 2. So for a button with the size
e.g. 80*25 i use a textureimage with the size 128*32 and
I use only the this 80*25 pixel of the image. Now i try to map
the texture so that this 80*25 pixels are on the plane.
But this is realy not a exactly solution to calculate the texture
coodinates for showing a part of a texture which should be
accurate to pixels
it there a bether solution ???
thanks or help and decipher my english
jep but how can i do this work
in the normalyway the texturecoords must be from
0.0-1.0
so i have something like this
glTexCoord2f(0.65864/0.2556,0);
when there is a possibility to set the
texcoords in pixel like
glTexCoord2f(80.0/128.0,0);
this where great ... but in normal way this don't work !
in the normalyway the texturecoords must be from
0.0-1.0
so i have something like this
glTexCoord2f(0.65864/0.2556,0);
when there is a possibility to set the
texcoords in pixel like
glTexCoord2f(80.0/128.0,0);
this where great ... but in normal way this don't work !
I had this same problem some time ago. I never figured out how... so.. if anyone knows how to fix this plz tell us ;)
glTexCoord2i (NOT f) will let u specify the numbers as intergers ab\nd not floats.
im not 100% sure if this is what youre after, i still cant see whats wrong with using eg glTexCoord2f(80.0/128.0,0);
im not 100% sure if this is what youre after, i still cant see whats wrong with using eg glTexCoord2f(80.0/128.0,0);
80/128 = 0.625
25/32 = 0.78125
So instead of using the range [0,1] for s and t use the range
[0, 0.625] for s and [0, 0.78125] for t.
25/32 = 0.78125
So instead of using the range [0,1] for s and t use the range
[0, 0.625] for s and [0, 0.78125] for t.
jep
i do this on this way at the moment but
its no realy nice to calculate this float
values for pixel values, but perhabs the only way :-(
i do this on this way at the moment but
its no realy nice to calculate this float
values for pixel values, but perhabs the only way :-(
There's nothing wrong with using these values instead of the full 0,1 range. Even those values are interpolated as floating point values for texture lookups, so there's no difference.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement