Renderer state.reset() no longer resets attributes

We perform some WebGL computation using the raw WebGL context (i.e. inside our animation frame callback but before our calls to Three to render the scene etc. We need to use the same context since we use some of the output from that work in three (e.g. some textures). In order to ensure that GL state is in a relatively predictable state before and after our raw context use, we call renderer.state.reset().

This was working great before r118, but it looks like that revision moved the management of attributes out of WebGLState and into WebGLBindingStates, and this means our call to renderer.state.reset() no longer disables the enabled attributes.

We were wondering if there was a way to clear these attributes with the new structure or, failing that, if you’d be open to us taking a look at how to introduce it with a PR?

Author: Fantashit

2 thoughts on “Renderer state.reset() no longer resets attributes

  1. I agree with @Mugen87. The Renderer inside (WebGL resource management) is complex. Exposing an API which affects internal WebGL resources can make it harder to maintain. Once we expose an API, we should keep the API unchanged as much as possible, then I think there my be a chance that exposing such an API can block the change (optimization) of the renderer inside.

    But, on the other hand, I know we sometimes have requests from users that they want to finely control WebGL resources by themselves. So I think it might be acceptable if the change is very simple and easy, and many users want this feature.

  2. Unfortunately we need to be careful to add this type of API as written in the above. So I’d like to suggest making your fork for now and revisiting in the core if we get the same feature request more.

Comments are closed.