klaude

Is that possible to reuse loaded textures in another canvas with new scene?

Recommended Posts

Hello, 

maybe this frequently required about preview dialog.

like when shows character preview in a dialog or popup ui with new canvas.

but i couldn't find the related post.

in my case, not a full screen game it's web application.

so, required multiple scenes for a dialog. 

BABYLONJS AssetsManager constructor needs a scene.

and can not reuse these loaded textures with another scene in normal.

when reused, it shows error like 'bindTexture: object not from this context'

Is that possible to reuse loaded textures in another canvas with new scene?

I don't want to request duplicated texture assets.

 

 

thanks.

Share this post


Link to post
Share on other sites

Texture cache is handled at the gpu level so that means it is bind to one WebglContext.

As Webgl does  not allow sharing texture across contexts we are bound to the same issue.

In your case the easiest might be to handle caching by loading the texture through xhr  as blob. From this you could reuse them across different engines with redownloading them. We do not have such automated mechanism because the browser cache in this help will help preventing redownloading the same file twice.

Share this post


Link to post
Share on other sites

OK, thanks @Sebavan

incidentally,

At first I used one webgl(babylonjs) and another canvas-2d(spine-canvas).

It looks like to share texture cache. 

in this case, canvas-2d logic has just redrawing with HTMLImageElement.

 

Share this post


Link to post
Share on other sites

an old topic. (around ~2014 Mozilla)  Finally ( 2 weeks ago) google chrome decided to jump on that train too. google it: offscreen webgl webworkers. This is the brand new hot sh** hype on my side of the internet :)
Multithreaded WebGL here we go. 

Share this post


Link to post
Share on other sites

Its old. but the big thing is that Chrome is supporting it, means 80% of population using the Internet are technically now able to take advantage of new technology.  Like back 10 year ago with  WelGL, when not Chrome is going do anything, the idea is dead.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.