Simply do:
tex.quad(image,vercices[1],vercices[2],vercices[3],vercices[4])
tex.quad(image,po[1],po[2],po[3],po[4])
It would have worked before too
Textured Polygons for All!
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All! [Parallel Edges Fixed]
- Attachments
-
- Easy.love
- It's that easy...
- (48.86 KiB) Downloaded 447 times
Re: Textured Polygons for All! [Parallel Edges Fixed]
Darn, you're right!
Always seem to things the hard way.
Next thing you know I'll want to just pass the quad rather than the individual vertices.
Thanks!
Always seem to things the hard way.
Next thing you know I'll want to just pass the quad rather than the individual vertices.
Thanks!
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All! [Parallel Edges Fixed]
So, what will you make?
Re: Textured Polygons for All!
OK!
To be consistent - "you're doing it all wrong" - here is some more of the same.
Can't seem to get the hang of the 'op' & 'rep' parameters.
Think these might do what I'm attempting in a more efficient manner but not sure.
I would like to be able to select a portion of an image and apply it to a quad (origin of texture => tex.x, tex.y and size of texture to apply => tex.h & tex.w).
Was successful in attached demo but had to resort to create a separate image for each quad.
(image_data source image=>intermediate image_data=>paste=>convert to image=>apply to quad)
Really ugly and ate up a lot of fps creating 82 separate images.
Mister genius, how would you do it?
To be consistent - "you're doing it all wrong" - here is some more of the same.
Can't seem to get the hang of the 'op' & 'rep' parameters.
Think these might do what I'm attempting in a more efficient manner but not sure.
I would like to be able to select a portion of an image and apply it to a quad (origin of texture => tex.x, tex.y and size of texture to apply => tex.h & tex.w).
Was successful in attached demo but had to resort to create a separate image for each quad.
(image_data source image=>intermediate image_data=>paste=>convert to image=>apply to quad)
Really ugly and ate up a lot of fps creating 82 separate images.
Mister genius, how would you do it?
- Attachments
-
- surface_texturing.love
- Add texture to a surface
- (19.05 KiB) Downloaded 186 times
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All!
--= Pre-Version 8 =--
I have some documentation included in the Perspective.lua, that may help as well as this:
texture.setRepeat(origin,size)
'origin' is a vector percentage of where to offset the image to. For example:
origin={0.25,0.5}
Would make the top left of the image slide to 25% across, and 50% down the polygon.
'size' is a vector percentage of the amount of image to capture. For example:
size={0.1,0.2}
Would make the whole image appear in every 10% by 20% size portion of the polygon.
So, texture.setRepeat({0.25,0.25},{0.5,0.5}) would make the texture appear every 50% starting at 25%.
I could change this to better suit your needs by making it image based, would you like me to do that?
EDIT:
Ah, now I see you're using an old version of the pixelEffect
The scaling was majorly screwed up in that version :L
I have some documentation included in the Perspective.lua, that may help as well as this:
texture.setRepeat(origin,size)
'origin' is a vector percentage of where to offset the image to. For example:
origin={0.25,0.5}
Would make the top left of the image slide to 25% across, and 50% down the polygon.
'size' is a vector percentage of the amount of image to capture. For example:
size={0.1,0.2}
Would make the whole image appear in every 10% by 20% size portion of the polygon.
So, texture.setRepeat({0.25,0.25},{0.5,0.5}) would make the texture appear every 50% starting at 25%.
I could change this to better suit your needs by making it image based, would you like me to do that?
EDIT:
Ah, now I see you're using an old version of the pixelEffect
The scaling was majorly screwed up in that version :L
Last edited by xXxMoNkEyMaNxXx on Wed Jan 23, 2013 11:35 pm, edited 2 times in total.
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All!
I just made a version that is image based.
origin is where the top left of the polygon starts in on the image (from the top left),
size is how much of the image to display.
These values are still percentages.
origin is where the top left of the polygon starts in on the image (from the top left),
size is how much of the image to display.
These values are still percentages.
- Attachments
-
- Perspective.lua
- Version 8 - Image based scaling :)
- (4.62 KiB) Downloaded 171 times
Last edited by xXxMoNkEyMaNxXx on Wed Jan 23, 2013 11:30 pm, edited 2 times in total.
Re: Textured Polygons for All!
Right!
Thanks, sort of how I read it.
Any possibility of translating that into something a mear mortal can grasp.
Like how does tex.x & tex.y map into 'op' (presumably have to do some scaling)
And where does tex.w & text.h go (width & height)?
I know you've said it but could you restate it for chlidren below the age of 5?
Have been thumping keys and got random results.
Know it's something obvious but am overlooking something.
Edit: You're just too fast for me. Will give your new library a go. Thanks!
Thanks, sort of how I read it.
Any possibility of translating that into something a mear mortal can grasp.
Like how does tex.x & tex.y map into 'op' (presumably have to do some scaling)
And where does tex.w & text.h go (width & height)?
I know you've said it but could you restate it for chlidren below the age of 5?
Have been thumping keys and got random results.
Know it's something obvious but am overlooking something.
Edit: You're just too fast for me. Will give your new library a go. Thanks!
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All!
To select a portion from a={x,y} to b={x,y} on an image that is size s={x,y}
origin=a/s
size=(b-a)/s
So basically, divide the location by the image size.
origin=a/s
size=(b-a)/s
So basically, divide the location by the image size.
Re: Textured Polygons for All!
All's well - almost, I guess!
Got what I asked for and more.
Thanks!
Did noticed that (I guess you would have expected this) that when the texture rolls over, the origin on the repeated images is {0,0} and not what is set by 'op'.
Got what I asked for and more.
Thanks!
Did noticed that (I guess you would have expected this) that when the texture rolls over, the origin on the repeated images is {0,0} and not what is set by 'op'.
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Textured Polygons for All!
What do you mean by rolls over, like the limit of the modulus?Did noticed that (I guess you would have expected this) that when the texture rolls over, the origin on the repeated images is {0,0} and not what is set by 'op'.
*Thinks a bit*
Ah, now I see what you mean.
'p0' and 'rep' are actually repeat options, not scaling, but the way I've got it set up, they can double as both.
Who is online
Users browsing this forum: Bing [Bot] and 9 guests