Skip to content

Conversation

@haroldiedema
Copy link
Contributor

You can no longer instantiate the WebGLRenderer in a worker context since r93 because of the WebGLAnimation things that have been added to the WebGLRenderer constructor code.

It blatantly assumes there is a window object available, which results in an immediate reference error as soon as you instantiate the renderer.

This PR fixes that, although it will result in errors when trying to use the onAnimationFrame functionality since it also assumes requestAnimationFrame is available in a worker context.

Then again, using requestAnimationFrame from a worker context doesn't make much sense anyway. 😄

@mrdoob
Copy link
Owner

mrdoob commented Jun 12, 2018

How about doing this instead?

if ( typeof window !== 'undefined' ) animation.setContext( window );

@mrdoob mrdoob added this to the r94 milestone Jun 12, 2018
@mrdoob mrdoob merged commit 8a9a106 into mrdoob:dev Jun 13, 2018
@mrdoob
Copy link
Owner

mrdoob commented Jun 13, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants