Sign in to follow this  
mede

2d menu texturing

Recommended Posts

mede    122
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

Share this post


Link to post
Share on other sites
mede    122
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 !

Share this post


Link to post
Share on other sites
zedzeek    529
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);

Share this post


Link to post
Share on other sites
mede    122
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 :-(

Share this post


Link to post
Share on other sites
digitec devil    206
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this