Changing RenderTarget's texture parameters on the fly
See original GitHub issueSometimes, when we want to save some memory, it happens that we have to reuse a render target, by just changing some possible parameters on the fly. I am talking about wrapping and filtering, obviously not format and type. Changing these parameters is (generally) fast enough (depending on the drivers).
However, it is not currently possible to do that, because of this part of the code:
https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLTextures.js#L225-L244
As a WebGLRenderTarget
has obviously no image attribute.
Maybe I am missing something, but it looks like the data uploading and the parameters and couple together. Am I the only one looking for a change on this side?
It would be nice to separate the data uploading from the parameters.
Three.js version
- All of them
Browser
- All of them
OS
- All of them
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
Right now, texture parameters are set via
setTextureParameters()
inWebGLTextures
. This function is used among others inuploadTexture()
.But using
texParameteri
just requires abindTexture
call and not atexImage2D
. So yes, it is basically possible to separate parameter settings from the actual texture upload.I actually got this working in my app for a while, I was able to update anisotropy, min and mag filters of my renderTarget. Would still get the tex2d errors but it worked.
Unfortunately while refactoring I took out some other Render Targets and it randomly stopped working. Couldn’t isolate the exact culprit.
Currently looking for a hack to fix it, so if anyone has any ideas pls let me know!