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 | |
| |_____| |
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.