View Full Version : How to fit a only a part of a texture?
05-17-2011, 07:57 AM
This may sound stupid, but If I have a texture 128x128px and a quad 120x120x can I texture it at 1:1 ratio (without clamping/resizing the texture to fit the quad)? Or maybe better - how do I "cut off" a part of the texture to fit the quad?
| _____ |
| | | |
| |Quad | |
| |_____| |
05-17-2011, 08:24 AM
The mapping between texture and geometry is determined by the texture coordinates you assign to each vertex of the geometry. To get the one-to-one mapping, you give the lower left vertex in your image tex coords (0, 0) and the upper right one (1, 1) and the remaining vertices accordingly.
To map the center area of the texture you'd use something like (0.25, 0.25) for the lower left and (0.75, 0.75) for the upper right vertex.
05-18-2011, 02:34 AM
Thanks, I'll try it out.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.