<h5 dir="auto">Description of the problem</h5>
<p dir="auto">I'm trying to update the wrapping and filtering of the texture in a WebGLRenderTarget object,<br>
however when updating the properties and setting <code class="notranslate">needsUpdate</code> of the texture to true, it throws the error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="THREE.WebGLState: TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': No function was found that matched the signature provided"><pre class="notranslate"><code class="notranslate">THREE.WebGLState: TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': No function was found that matched the signature provided
</code></pre></div>
<p dir="auto">I made a fiddle to test it here: <a href="https://jsfiddle.net/7bdLa8of/10/" rel="nofollow">https://jsfiddle.net/7bdLa8of/10/</a></p>
<p dir="auto">I looked around the code and found that since image is not undefined <a href="https://github.com/mrdoob/three.js/blob/952b8a3e31ec08a1b08b62e9947755a7be74701c/src/renderers/webgl/WebGLTextures.js#L330">here</a> (it's <code class="notranslate"> { width, height }</code>) it gets treated as an HTMLElement <a href="https://github.com/mrdoob/three.js/blob/952b8a3e31ec08a1b08b62e9947755a7be74701c/src/renderers/webgl/WebGLTextures.js#L813">here</a> and fails.</p>
<p dir="auto">I tried simply guarding it with a isRenderTarget and skipping the previous line and also <a href="https://github.com/mrdoob/three.js/blob/952b8a3e31ec08a1b08b62e9947755a7be74701c/src/renderers/webgl/WebGLTextures.js#L639">this</a>, however that left me with a black texture.</p>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r115</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Chrome</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Firefox</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Internet Explorer</li>
</ul>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Windows</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> macOS</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Linux</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Android</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> iOS</li>
</ul>
<p dir="auto">Sometimes, 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).</p>
<p dir="auto">However, it is not currently possible to do that, because of this part of the code:</p>
<p dir="auto"><a href="https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLTextures.js#L225-L244">https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLTextures.js#L225-L244</a></p>
<p dir="auto">As a <code class="notranslate">WebGLRenderTarget</code> has obviously no image attribute.</p>
<p dir="auto">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?</p>
<p dir="auto">It would be nice to separate the data uploading from the parameters.</p>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
</ul>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
</ul>