Webgl points renderer / use a smaller canvas for hit detection render

The hit detection render is now done against a canvas with half the
width/height of the main render. This still provides sufficient precision
while requiring a much smaller memory allocation (especially for
retina devices).
This commit is contained in:
Olivier Guyot
2019-10-31 13:40:51 +01:00
parent 43010c8934
commit 600e1a4647
2 changed files with 7 additions and 3 deletions

View File

@@ -456,9 +456,10 @@ class WebGLHelper extends Disposable {
*/
prepareDrawToRenderTarget(frameState, renderTarget, opt_disableAlphaBlend) {
const gl = this.getGL();
const size = renderTarget.getSize();
gl.bindFramebuffer(gl.FRAMEBUFFER, renderTarget.getFramebuffer());
gl.viewport(0, 0, frameState.size[0], frameState.size[1]);
gl.viewport(0, 0, size[0], size[1]);
gl.bindTexture(gl.TEXTURE_2D, renderTarget.getTexture());
gl.clearColor(0.0, 0.0, 0.0, 0.0);
gl.clear(gl.COLOR_BUFFER_BIT);