Jump to content
  • Advertisement
Sign in to follow this  
mede

2d menu texturing

This topic is 5095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!