Canvas problem; canvas not right size? Gamera?

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
Skeiks
Citizen
Posts: 51
Joined: Wed Jan 28, 2015 1:51 pm

Canvas problem; canvas not right size? Gamera?

Post by Skeiks »

I wish I could explain this better, but I'll try.

Right now I have a graphic effect that requires the use of a lot of small graphic calls. I figured I would draw this effect to a canvas, and then just draw that canvas to increase performance. Long story short, it didn't work. For some reason the canvas is only displaying as like 60% of the area I set it too, and my draw calls to it are really mucked. I think it has something to do with Gamera but I'm not sure. Anyone have any idea? I understand it's a lot of code to go through, and it's quite the mess.

as of now I just made the canvas a big white square to see where it is, and it's not where it's supposed to be. It should be the entire screen.
Attachments
fore.love
(1.43 MiB) Downloaded 107 times
Joe Black
Prole
Posts: 39
Joined: Wed Jan 21, 2015 1:57 pm

Re: Canvas problem; canvas not right size? Gamera?

Post by Joe Black »

Hi, your right the clipping of the canvas comes from gamera

when gamera draw it uses love.graphics.setScissor to limit the drawing area (I never heard about this function before but I'm happy to discover it :awesome: )
So when you draw your canvas, the draw doesn't go beyond 1280 in width due to your setting.

To solve it you can delete the setScissor call but you'll lose efficiency.
Or try to create those canvas out of the gamera draw

PS : yes, it's quite a mess, at least think about auto indentation :3
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Canvas problem; canvas not right size? Gamera?

Post by kikito »

Do you need to do the canvas manipulation inside the camera:draw(...) function? It seems that you should be doing it before using the camera at all.
When I write def I mean function.
User avatar
Skeiks
Citizen
Posts: 51
Joined: Wed Jan 28, 2015 1:51 pm

Re: Canvas problem; canvas not right size? Gamera?

Post by Skeiks »

Joe Black wrote:Hi, your right the clipping of the canvas comes from gamera

when gamera draw it uses love.graphics.setScissor to limit the drawing area (I never heard about this function before but I'm happy to discover it :awesome: )
So when you draw your canvas, the draw doesn't go beyond 1280 in width due to your setting.

To solve it you can delete the setScissor call but you'll lose efficiency.
Or try to create those canvas out of the gamera draw

PS : yes, it's quite a mess, at least think about auto indentation :3

Thank you! I didn't even think about the scissor. I removed it and the white now fills the entire screen meaning the canvas is being drawn. Now I'm going to have to work on getting the grass particles to actually draw right on the canvas. And I'll think about it lol.

kikito wrote:Do you need to do the canvas manipulation inside the camera:draw(...) function? It seems that you should be doing it before using the camera at all.
Your'e right, I don't. Didn't even consider just drawing to the canvas out of the draw method, I was trying to do all these transforms to undo what the camera was doing. Can I perform draw calls in the update loop to create a canvas? If not, once I get home I'll just split my particle draw function in two.

Thanks! Without anim8 or gamera I wouldn't be anywhere near as far as I am making this game.
User avatar
Skeiks
Citizen
Posts: 51
Joined: Wed Jan 28, 2015 1:51 pm

Re: Canvas problem; canvas not right size? Gamera?

Post by Skeiks »

That did it, after I moved the draw call out of the camera draw everything worked perfectly. I'll keep that in mind for later.
User avatar
DeltaF1
Citizen
Posts: 64
Joined: Mon Apr 27, 2015 4:12 pm
Location: The Bottom of the Stack
Contact:

Re: Canvas problem; canvas not right size? Gamera?

Post by DeltaF1 »

I hope we'll see this game in the Projects subforum soon, it looks very interesting :P
Post Reply

Who is online

Users browsing this forum: No registered users and 55 guests