Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple PIXI.Stage's on one page #23

Closed
Tolmark12 opened this issue Mar 22, 2013 · 5 comments
Closed

Multiple PIXI.Stage's on one page #23

Tolmark12 opened this issue Mar 22, 2013 · 5 comments

Comments

@Tolmark12
Copy link

When I have more than one pixi stage on a page that uses textured sprites, the first stage renders the sprite just fine, however the second throws the error:

WebGL: INVALID_OPERATION: bindTexture: object not from this context 

Here's an example, once it loads, click run with the console open:
http://jsfiddle.net/tolmark12/dDWD9/1/ (coffeescript)

edit : updated js fiddle link

@GoodBoyDigital
Copy link
Member

Interesting use case!

The issue lies with the fact that the pixi.js texture cache stores textures but only for one webGL context. At the moment you cant use the same texture in multiple contexts as each instance of webGL requires its own one.

If you dont use the texture cache it works all good..

http://jsfiddle.net/HrGVq/

A possible solution could be to create a new texture cache for each instance of a webGL renderer..

@Tolmark12
Copy link
Author

I see, very good. Creating a new texture cache for each instance will work perfect.

Thanks for the help!

@GoodBoyDigital
Copy link
Member

Happy to help :)

@Tolmark12
Copy link
Author

As I put this into practice, I'm still getting that error. I think it might have something to do with when the WebGLRenderer render method runs?

http://jsfiddle.net/tolmark12/zmJtD/3/

Uncommenting line 15 fixes the problem in the jsFiddle example, but doesn't fix the issue in my app (even though the implementations are essentially the same). I'm wondering if it is because there is a lot more javascript running elsewhere on my app's page which somehow causes the renderer to lag before rendering?

I'm shooting in the dark here, but does this spark any thoughts?

@lock
Copy link

lock bot commented Feb 27, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants