Original Post
🔒 Locked
Linear interpolation behaviour
Advertisement
Dont use GL_LINEAR if there is no need to use interpolation
OpenGL does the interpolation, surely.
But if you want to draw exact quad, yo must specify exact texture coordinates.
Unfortunately, they are not 0 and 1.
Imagine, you texture width is W and height is H.
So, exact coordinates would be from 0.5/W to 1.0 - 0.5/W horizontally, and 0.5/H to 1.0 - 0.5/H vertically.
To read more about why is it so, look here:
http://download.nvidia.com/developer/NVTextureSuite/Atlas_Tools/Texture_Atlas_Whitepaper.pdf
page 12
But if you want to draw exact quad, yo must specify exact texture coordinates.
Unfortunately, they are not 0 and 1.
Imagine, you texture width is W and height is H.
So, exact coordinates would be from 0.5/W to 1.0 - 0.5/W horizontally, and 0.5/H to 1.0 - 0.5/H vertically.
To read more about why is it so, look here:
http://download.nvidia.com/developer/NVTextureSuite/Atlas_Tools/Texture_Atlas_Whitepaper.pdf
page 12
@blizzard999: Well, this seems obvious but is a problem if you need to interpolate some parts of a texture and some not...
@Jackis: Thank you very much, that helped me a lot. The solution is really that simple. Just add an offset of 0.5f to every coordinate and you're doing fine (using endpoint-exclusive rect required). You also have to do this with the destination coords and everything works fine. I also got rid of the recommended gltranslatef(0.375, 0.375, 0.0), doesn't work reliable.
@Jackis: Thank you very much, that helped me a lot. The solution is really that simple. Just add an offset of 0.5f to every coordinate and you're doing fine (using endpoint-exclusive rect required). You also have to do this with the destination coords and everything works fine. I also got rid of the recommended gltranslatef(0.375, 0.375, 0.0), doesn't work reliable.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement