On Fri, Apr 10, 2009 at 5:20 AM, Greg Ewing <[email protected]> wrote:
>
> bobmitch wrote:
>> When blitting textureatlas images to screen with non-integer
>> coordinates (really necessary for visually appealling and smooth
>> scrolling/movement) there are sampling artifacts from adjacent
>> textures in the atlas.
>
> To prevent that you need to adjust the texture coordinates
> so they start half a texel in from the edges of the
> subtexture.
>
> E.g. if your subtexture is 100x100, then you use texture
> coordinates (0.5, 0.5, 99.5, 99.5).

Unfortunately it's not quite that simple, since texture coordinates do
not map directly to texels -- the coordinate range for the entire
texture is 0.0-1.0 regardless of texture size. To figure out the width
of "half a texel" you'll need to calculate it based on the size of the
texture. Something like this:

half_texel_height = 0.5 / texture.height
half_texel_width = 0.5 / texture.width

You could then offset your texture coordinates based on those half texel sizes.

-Casey

Then correct the "full" texture coordinates based on

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to