[PLUGIN] Canvas

Post your completed addons to share with the community

Post » Fri Dec 14, 2012 10:53 am

@rexrainbow : you're right, you need to load it into in image and paste it.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Fri Dec 21, 2012 12:34 am

I had made a behavior to load image from url for canvas plugn, this code was modified from sprite.rexrainbow2012-12-21 02:23:01
B
97
S
22
G
178
Posts: 4,122
Reputation: 104,051

Post » Thu Dec 27, 2012 6:28 pm

Would it be possible to add a "fill path with gradient" command to this plugin?
B
8
Posts: 32
Reputation: 1,039

Post » Thu Dec 27, 2012 9:44 pm

Hello,

I thought this issue was related to the Canvas plugin, but when I remove everything but the canvas it wasn't happening anymore, so trial and error to find out it might also be related to the platform behavior. But, I'm posting it here because the Canvas plugin is the part that isn't native (and seems like it may be the issue).

When a canvas and a sprite(with the platform behavior) are in the layout there is a notable decrease in FPS. Even if neither is doing anything. But ONLY when webgl is "on". Even though nothing is using webgl as far as I can tell (maybe I missed something).

Here is a capx example:
http://dl.dropbox.com/u/659906/canvas_test.capx

Sorry for the complicated button presses to show FPS. But I wanted to make sure the text was not part of the issue.

In this capx, you press "enter" to save the fps to a variable, then hold "space" to show it on screen. When you release space the text will be destroyed.

Enter- save fps to variable
Space (Hold)- display saved variable on screen.
Space (Release)- destroy text on screen
1- destroy sprite with "platform" behavior
2- create sprite with "platform" behavior
0- destroy canvas
9- create canvas


If you destroy the sprite or the canvas, the FPS picks up to 60. If you add more than one sprite, there is no change in FPS. If you add more than one canvas there is additional drop of FPS.

also, if you turn off webgl there is no issue with fps.


I would appreciate a second set of eyes here, as well as any suggestions on what I may be doing wrong.

Additionally, I'd like to say this is an issue that came about with the newest C2 release, but I've yet to uninstall/reinstall/test.
B
16
S
1
G
3
Posts: 43
Reputation: 2,597

Post » Thu Dec 27, 2012 10:34 pm

@cymrix
It's a known issue with the canvas plugin. The plugin was originally made using just canvas2d (or no webgl). With webgl enabled every time the object draws, it's image is copied to a texture so it can be drawn, this is what causes the fps drop. The recommended solution is to set webgl to off.
B
79
S
24
G
54
Posts: 4,753
Reputation: 40,769

Post » Fri Dec 28, 2012 3:38 am

I see. Thank you.

Now that I know what to search for I've found other threads with the same issue. Sorry about that.


Here is a good thread about it:
http://www.scirra.com/forum/canvas-object-webgl-memory-issue-solved_topic49105.html
B
16
S
1
G
3
Posts: 43
Reputation: 2,597

Post » Thu Jan 03, 2013 6:39 pm

Hello.

@R0J0hound, on canvas resize the contents get deleted. Is that the intended behaviour?
B
34
S
8
G
5
Posts: 32
Reputation: 5,385

Post » Thu Jan 03, 2013 7:25 pm

Yes, it changes the size of the canvas texture, the image itself is discarded.
B
79
S
24
G
54
Posts: 4,753
Reputation: 40,769

Post » Tue Feb 12, 2013 2:36 pm

Hi everyone. :)

I used the DrawCanvas example, made a Sprite with a picture, put it on a layer, and "on layout start" I made the sprite "Destination atop", and paste the layer into canvas. Everything works fine.

But if I choose "Fullscreen in browser" in "Scale" or "Letterbox Scale" mode the pencil and the brush works, but not the bucket. Did I miss something?
B
2
Posts: 1
Reputation: 402

Post » Sun Mar 03, 2013 11:39 pm

Hey R0j0 , did you make some effect example I can study , I really want to learn this awesome plugin , If you could make me a little trail that gets smaller after time example , I would be delighted :D
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 4 guests