Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help,
read this .
j0nte33
Prole
Posts: 3 Joined: Tue Nov 08, 2016 8:00 pm
Post
by j0nte33 » Tue Nov 08, 2016 8:13 pm
I'm having problem setting up my UV coordinates with my trianglestrip.
here is an image:
(pretty
)
This image is created by 3 cubes (6 triangles)
I want the middle texture to not be flipped.
I can't seem to get it right, any value i try.
(the positions go from bottom up, then jump to right)
here is how i construct the mesh:
Code: Select all
x:0 y:200 u:0 v:1
x:0 y:0 u:0 v:0
x:200 y:200 u:1 v:1
x:200 y:0 u:1 v:0
x:400 y:200 u:0 v:1
x:400 y:0 u:0 v:0
x:600 y:200 u:1 v:1
x:600 y:0 u:1 v:0
s-ol
Party member
Posts: 1077 Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:
Post
by s-ol » Tue Nov 08, 2016 11:40 pm
j0nte33 wrote: I'm having problem setting up my UV coordinates with my trianglestrip.
here is an image:
(pretty
)
This image is created by 3 cubes (6 triangles)
I want the middle texture to not be flipped.
I can't seem to get it right, any value i try.
(the positions go from bottom up, then jump to right)
here is how i construct the mesh:
Code: Select all
x:0 y:200 u:0 v:1
x:0 y:0 u:0 v:0
x:200 y:200 u:1 v:1
x:200 y:0 u:1 v:0
x:400 y:200 u:0 v:1
x:400 y:0 u:0 v:0
x:600 y:200 u:1 v:1
x:600 y:0 u:1 v:0
you want just four vertices with
Code: Select all
{ x=0, y=200, u=0, v=1 },
{ x=0, y=0, u=0, v=0 },
{ x=600, y=0, u=3, v=0 },
{ x=600, y=200, u=3, v=1 },
you can of course add the intermediate ones anyway but you still need to increment:
Code: Select all
x:0 y:200 u:0 v:1
x:0 y:0 u:0 v:0
x:200 y:200 u:1 v:1
x:200 y:0 u:1 v:0
x:400 y:200 u:2 v:1
x:400 y:0 u:2 v:0
x:600 y:200 u:3 v:1
x:600 y:0 u:3 v:0
remember to texture:setWrap("repeat", "repeat")!
j0nte33
Prole
Posts: 3 Joined: Tue Nov 08, 2016 8:00 pm
Post
by j0nte33 » Wed Nov 09, 2016 12:27 pm
ah that makes sense!
The reason I'm using more than four vertices is because i want to generate a mesh based of a spline.
I didn't realize i could have the UV coordinates outside the range of 0-1.
It works! thank you!
here is a short video:
http://puu.sh/sbf6N.webm
zorg
Party member
Posts: 3465 Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:
Post
by zorg » Wed Nov 09, 2016 1:54 pm
j0nte33 wrote: I didn't realize i could have the UV coordinates outside the range of 0-1.
You can, but the behaviour will depend on the [wiki]WrapMode[/wiki] chosen.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Users browsing this forum: Ahrefs [Bot] , Google [Bot] and 2 guests