<p dir="auto">I'm working on an application with many different code paths that load textures and I've patched the WebGLRenderer to cache textures also on the GL level, so that <code class="notranslate">uploadTexture</code> and <code class="notranslate">onTextureDispose</code> use a dictionary to see if a texture has aleady been uploaded or are no longer used, which can reduce VRAM usage and does not need sweeping changes in other parts of the code.</p>
<p dir="auto">Is that a useful thing for others, too? Or is there side-effects I'm missing / is it too specific to be useful within three.js?</p>
<h5 dir="auto">Description of the problem</h5>
<p dir="auto">When entering VR mode, <code class="notranslate">VREffect</code> sets the pixel ratio to 1. It saves a backup of the original value as <code class="notranslate">rendererPixelRatio</code> so it can set it back to what it was when exiting VR presentation. However, with the webvr-polyfill, both the full screen event handler and <code class="notranslate">vrdisplaypresentchange</code> fire, so whichever one runs second will overwrite <code class="notranslate">rendererPixelRatio</code> with 1.</p>
<p dir="auto">Since there's a lot of repeated code in the two event handlers, I propose unifying them into a single function. At the top of that function, we'll check if the value of <code class="notranslate">isPresenting</code> is the same as it was before and abort if the values match. That way, we avoid running the same code twice.</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=""> Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r76</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"> 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>
<h5 dir="auto">Hardware Requirements (graphics card, VR Device, ...)</h5>
<p dir="auto">webvr-polyfill and a mobile browser</p>