Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by aceangel

Does ejecta support multiple canvases of different sizes?

1 decade ago by Joncom

Depends what you mean I think. You can render to off-screen canvases of nearly any size you want. However, I suspect you are limited to the single "always filling your display" canvas. For what reason would you ever need another?

1 decade ago by aceangel

I was just developing a plugin for impact that used multiple offscreen canvases. I'm using it with intel XDK which is supposed to be based on ejecta. The issue I ran into was that each canvas I created had a default size of 1024x768 (I guess the default size is the maximum display size) and no way to modify the width/height. I made a new texture atlas and each part I created from the atlas had to be 1024x768 when I copied it to a new canvas. Then when I had to use it, I had to scale it down back to its original size, using drawImage() to the main canvas' context. I would end up with the multiple "always filling your display" canvases and it would crash my program. I'm guessing too much memory would be used up. I heard that pre-rendered canvases had a speed advantage vs writing to the screen.

1 decade ago by Joncom

Yes, there is a speed advantage. It's always quicker to draw one thing that it is to draw many things.

So, if you can build a canvas/image comprised of many things by drawing them all to an off-screen canvas, then you can draw this composite canvas/image and it will only count as one draw.

If, on the other hand, you were to re-render all the individual components during every draw cycle, you'd be drawing way more stuff (and take a performance hit).

As for the not being able to change your off-screen canvas width/height, that sounds strange. I've not really used Ejecta, but something tells me you should be able to create custom width/height canvases.
Page 1 of 1
« first « previous next › last »