Just wondering...

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.
User avatar
Chief
Party member
Posts: 101
Joined: Fri Mar 12, 2010 7:57 am
Location: Norway, 67° north

Just wondering...

Post by Chief »

Are there any ways / functions to distort images like this in löve?

Original:
Image

Distorted:
Image
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Just wondering...

Post by Robin »

Perhaps with some rotate/scale/rotate combo?
Help us help you: attach a .love.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Just wondering...

Post by vrld »

Robin wrote:Perhaps with some rotate/scale/rotate combo?
No, you would need a 'shear' transformation, which is not supported by love.graphics
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Just wondering...

Post by Taehl »

Darn. That would be /really/ handy. It wouldn't be so complex to do (assuming Love renders each image as a 2-polygon rectangle)... Maybe we should request this feature?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Just wondering...

Post by Robin »

I'd say so, especially if there's already an OpenGL or SDL API call to do that, which just has to be exposed.
Help us help you: attach a .love.
User avatar
Chief
Party member
Posts: 101
Joined: Fri Mar 12, 2010 7:57 am
Location: Norway, 67° north

Re: Just wondering...

Post by Chief »

Im sure I've seen this been done in the "3D Dice" game:
http://love2d.org/forums/viewtopic.php?f=5&t=1692

... to draw the faces of the dices.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Just wondering...

Post by Jasoco »

It only skews. It doesn't distort.
User avatar
Chief
Party member
Posts: 101
Joined: Fri Mar 12, 2010 7:57 am
Location: Norway, 67° north

Re: Just wondering...

Post by Chief »

Robin wrote:I'd say so, especially if there's already an OpenGL or SDL API call to do that, which just has to be exposed.
Indeed!
Jasoco wrote:It only skews. It doesn't distort.
I guess that would work too. :o:
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Just wondering...

Post by Jasoco »

The Dice thing fooled me at first too until I noticed that the images that were being used for faces could only be skewed like a rhombus. Rather than distorted over a trapezoidal shape which is the main ingredient for making textured 3D polygons.

Once Löve can do distorted images shaped to any polygon mask, we'll be able to do real 3D. If only low-polygon. Though people have proven Löve is pretty powerful in the past and can do a lot of stuff really fast while keeping a fair enough framerate.

We'll need to be able to:
A) Define a polygon shape with 3 or more sides
B) Apply an image to that shape
C) Adjust the image's base coordinates and rotation

love.graphics.texturedPoly(image, quad, imageoffsetX, imageoffsetY, imagerotation, imagescale, x1, y1, x2, y2, x3, y3 ...)

Or something like that. Maybe simpler. Of course the points portion would accept an array of X and Y coordinates if need be.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Just wondering...

Post by vrld »

Jasoco wrote:love.graphics.texturedPoly(image, quad, imageoffsetX, imageoffsetY, imagerotation, imagescale, x1, y1, x2, y2, x3, y3 ...)
As cool as that would be, it would introduce another problem:
How to map the texture onto the polygon? Where is the "origin" of the texture to take the offset from?
More technically: What texture coordinates to assign to the vertices (xi,yi) of the polygon?
I suppose you could introduce something like love.graphics.texturedPolygon(image, x1,y1,u1,v1, ...) where u and v denote texture coordinates; but that seems rather unlövely.
on another note: love-glsl is probably capable of such things...
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 39 guests