Sign in to follow this  
seraphpl

Draw on top of rendered bitmap

Recommended Posts

Hi, is there a low level API to draw on top of what's already rendered like html canvas api?

I don't want draw everything again on each frame when there is only little change.

Say, we have already drew 100,000 lines a canvas. On next frame, we only need to draw another line of from position 0,0 to position 10,0. We don't want to clear the canvas and draw 100,001 lines again.

In html canvas api, we can do something line beginPath + draw line + closePath, then beginPath + draw line + closePath, and then so on...

Share this post


Link to post
Share on other sites

No, and it doesnt exist for reason - every such operation involves many computations to make those lines, so its better to be cached. If you want to do it each frame, well, just clear() graphics and refill it each time. The downside is that memory for polygon and buffers will be re-allocated each time, but you can try modify it and use "invalidate()" thingy in graphicsGeometry if it becomes a problem.

Alternatively, PIXI.Mesh or PIXI.SimpleMesh with drawMode LINES, draws lines of width=1, where you modify vertices each frame, should work for you. I unfortunately dont have time to make basic demos for you.

If you give me more details, maybe i can throw you some pieces of code i have. The whole problem exists because on our lowest-level, webgl doesnt actually have lines  ;) 

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.