Skip to main content
GameDev.net gamedev.net
🔒 Locked

Clamping UV texture co-ordinates

Started by David Clark Jan 15, 2007 at 1:55 AM 2 replies 3.1k views
Original Post
David Clark
David Clark
I'm working on a 2d game and I've noticed that when the sprites increase in size the edges of the texture seem to wrap. The texture co-ordinates are simply 0,0,1,1. I know I could fix this by giving all my sprites a transparent border, but i'm sure there must be a solution as this kinda thing would surely affect 3d games! I remember back in the days i used to use blitzbasic and i had a texture which was a gradient. The ground was black, and the texture of the walls were a gradient of black to white, and the sky was white. I had a wrap problem back then as the top of the walls had some white appear on them, but there was an option to fix it called 'CLAMPUV'. So I'm wondering how do i go about this in direct x? is there a render state or something ? Thanks in advance :)
Demus79
Demus79
[edit : too slow]

Hello,

There is a (texture)sampler state for U,V and W texture coordinates which you can set to clamp, wrap or mirror. So you answered your own question already :)

Cheers !

David Clark
David Clark
oh such a simple solution! i feel like such a noob. Thanks heaps both of u!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.