Skewing/Shearing and Canvases

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.
Post Reply
User avatar
meganukebmp
Prole
Posts: 8
Joined: Thu Jan 07, 2016 10:38 pm
Location: Sofia, Bulgaria

Skewing/Shearing and Canvases

Post by meganukebmp »

Hey, I'm trying to skew a background with objects that are updating each frame. I thought about drawing them on a canvas and then using graphics.shear on it but the canvas remains static. Is there a way to apply any type of translation effect on multiple objects while still updating them?
Here is a pic of what I am trying to do. Black rectangles have to be able to update. Red is the canvas on which all the objects are being drawn.
Image
Thanks in advance.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Skewing/Shearing and Canvases

Post by s-ol »

love.graphics.shear should work with and without canvas'. Are you sure you know how to use it? Or do you experience the bug from the wiki page?

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
meganukebmp
Prole
Posts: 8
Joined: Thu Jan 07, 2016 10:38 pm
Location: Sofia, Bulgaria

Re: Skewing/Shearing and Canvases

Post by meganukebmp »

S0lll0s wrote:love.graphics.shear should work with and without canvas'. Are you sure you know how to use it? Or do you experience the bug from the wiki page?
Nvm what I just said. I fixed the canvas not working. I cant figure out how to use shear to achieve this effect though. Since I cant just skew it vertically from the center. I'm missing something.
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Skewing/Shearing and Canvases

Post by micha »

meganukebmp wrote:I cant figure out how to use shear to achieve this effect though. Since I cant just skew it vertically from the center. I'm missing something.
It is not possible to create a perspective effect using shearing. When you shear an image, then parallel lines always stay parallel.
User avatar
meganukebmp
Prole
Posts: 8
Joined: Thu Jan 07, 2016 10:38 pm
Location: Sofia, Bulgaria

Re: Skewing/Shearing and Canvases

Post by meganukebmp »

micha wrote:
meganukebmp wrote:I cant figure out how to use shear to achieve this effect though. Since I cant just skew it vertically from the center. I'm missing something.
It is not possible to create a perspective effect using shearing. When you shear an image, then parallel lines always stay parallel.
Is there another way to do it then? Are there any libs that allow me to achieve this?
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Skewing/Shearing and Canvases

Post by Jasoco »

meganukebmp wrote:
micha wrote:
meganukebmp wrote:I cant figure out how to use shear to achieve this effect though. Since I cant just skew it vertically from the center. I'm missing something.
It is not possible to create a perspective effect using shearing. When you shear an image, then parallel lines always stay parallel.
Is there another way to do it then? Are there any libs that allow me to achieve this?
A user named xXxMoNkEyMaNxXx made one for me once for a project, but it's a bit finicky in some projects depending on how they're made, and has some problems. It's a shader. And 0.10.0 breaks it slightly over the fixed 0.9.x version. But here's a post where a 0.9.1 fix was made by someone:

viewtopic.php?f=3&t=2198&p=174908&hilit ... ry#p174908

It'll probably need tweaking of course.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Skewing/Shearing and Canvases

Post by bobbyjones »

You would be able to do it with love3d I played with a little bit and cpml's mat4 already has perspective in it. I only used the ortho but im sure the perspective would work as expected. I recommend going to their forum and download their demo from the second to last page and use that as a base to mess with. If you have any trouble with it then join irc and talk to holo or karai they made it.
https://github.com/excessive/love3d
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 152 guests