WoW:API Texture SetTexCoord: Difference between revisions

m
(Changed origin from bottom left to top left)
Line 18: Line 18:


== Note ==
== Note ==
:The function cut a sub-region,use the new TopLeftPoint is (left,top),new BottomRight is (right,bottom),so you can use the function to rotate the texture or sub-region. The more complex 8-argument form allows for arbitrary affine transformations, see [[SetTexCoord Transformations]] for details.
:The function cuts a sub-region out of the texture to display ingame.
:*Unless you want to do rotations, use the ''(left,right,top,bottom)'' notation.
:*The more complex 8-argument form allows for arbitrary affine transformations, see [[SetTexCoord Transformations]] for details.<BR>Basically the four points you specify still have to form a rectangle, but you can rotate and place it more freely.<BR>Experience with matrices is recommended since they can help you find the final coordinates of your points.
 
:The example below cuts out the lower left quarter of the texture file.
 
== Example ==
== Example ==
  getglobal("MyAddOnTexture" .. id):SetTexCoord(0, 0.5, 0.5, 1);
  getglobal("MyAddOnTexture" .. id):SetTexCoord(0, 0.5, 0.5, 1);