Quick question:
Is it possible to draw a 2d polygon and fill it with a repeating texture with the love2d api? I can't find any methods to do this.
Textured Polygon
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Textured Polygon
It's not possible.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Textured Polygon
.. at the moment.thelinx wrote:It's not possible.
Re: Textured Polygon
Okay
I wonder if there could be a way to emulate it though, with the functions we stuck with.
Since the common use for such a thing would be terrain and map making (think soldat), we could just render it to a sprite and then treat it as a sprite.
What if, I somehow drew the polygon in white using the built in functions and onto a black sprite and then used that as an alpha mask or something?
I wonder if there could be a way to emulate it though, with the functions we stuck with.
Since the common use for such a thing would be terrain and map making (think soldat), we could just render it to a sprite and then treat it as a sprite.
What if, I somehow drew the polygon in white using the built in functions and onto a black sprite and then used that as an alpha mask or something?
- slime
- Solid Snayke
- Posts: 3170
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Textured Polygon
You will be able to do stuff with Pixel Effects (fragment shaders) and/or image masks in 0.8.0 to possibly achieve something similar.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Textured Polygon
well, you could generate it with an imagedata, copying the background image repeatedly on it, and then "erasing out" the pixels outside the polygon by maxing their alpha individually. not pretty or fast, buy feasible at the beginning of each level.
When I write def I mean function.
Re: Textured Polygon
can't you use a quad and http://love2d.org/wiki/(Image):setWrap
Re: Textured Polygon
...and now it is! Check the attachment, or the source code at GitHub: https://github.com/miko/Love2d-samples/ ... redPolygonbartbes wrote:.. at the moment.thelinx wrote:It's not possible.
- Attachments
-
- TexturedPolygon.love
- (3.84 KiB) Downloaded 571 times
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
Re: Textured Polygon
Well, uh, holy shit!
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Textured Polygon
Now, if you can get it to distort, we'd have the makings for creating a 3D engine.
Who is online
Users browsing this forum: Bing [Bot] and 7 guests