Jump to content

cheap way to repeatedly draw texture?


naychrist
 Share

Recommended Posts

hi all,

I am trying to optimise a game using pixi. at the moment I have tens of players on screen firing bullets at each other, which knocks a few frames off the frame rate. The bullets are currently created by drawing a circle inside each bullets own PIXI.Graphics object, which I assume is inefficient.

I have since created an image file to tint and render for each bullet but creating a sprite of this texture for every bullet seems like overkill. Is this the best way to do it and if so how best to load the picture once then copy to all the sprites?

I assume there is no pixi way to bind the texture once then draw repeatedly? Ages ago when working with c++/opengl I would have done this using point sprites although I realise shaders are the preferred approach now.

any advice on the pixi way (or other ways) to do this would be appreciated!

 

EDIT - have ended up create one PIXI.Texture and then create a sprite per bullet passing this into the constructor. This has helped my performance but if any other tips I'd love to hear them! Maybe I'm over thinking this if pixi is doing batching etc under the hood.

Edited by naychrist
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...