Best method for rendering vector graphic with software mode


I have a c++ app that scrolls big Sprites made with the drawing API (simple shapes though). I need to use software rendering because of the user computer. And I wonder what is the best method to optimize time rendering and memory.

For now, I create my Sprites with the drawing API and if I need twice the same Sprite on screen I clone it with; And I addChild only what’s on screen and scroll everything.

But what if copy/past the drawing in BitmapData and use Bitmap instead? Is it better?
What if I use graphics.clear() and draw every frame instead of scrolling containers?

My goal is to reduce memory and CPU use in software mode.

1 Like

You add one child for every image you draw with the api?
I dont know if is the best way but, I draw in just one sprite all the images and them mach with it position to know wath image i´m clicking on… and just scroll that sprite

It depends on a lot of factors. If the machine has enough memory to store the bitmaps (and some to spare for other tasks), they might still be fastest. On the other hand, if memory is a bottleneck, then vector graphics will be more likely to work better.

Speaking of vector graphics, have you considered using Shape rather than Sprite? That saves a little bit of overhead.

No. I made the change like you suggest. I think I don’t have significant boost because I have only few Shapes (but big: 1024x768).

I’ll made some test to see what is better.

Thanks for your comment guys.

I’m not sure if I understand correctly your scroll goal, but if you want to scroll everything together, you can just change x/y of parent Sprite.

Maybe I put the wrong title. I’ll change it. I know how to scroll. My problem is memory and cpu usage with vector graphics in SOFTWARE mode.

Honestly, I got the impression they were even bigger than that. Yes that’s pretty big, but most machines should be able to handle a limited number of bitmaps like that.

Maybe it’s worth trying all three options.

maybe that’s because I use software + ANGLE. It takes so much memory comparing to hardware + opengl :confused:

What happens with hardware + ANGLE?

I’ve got a runtime error ( strlen not located AND Shader isn’t initialized…see my other topic)