Pārlūkot izejas kodu

Switch to `highp` precision for equirectangular fragment shader.

This resolves pixelation issues on some mobile devices (fixes #725).
It also may be related to issues #301, #496, #683, and #708.
tags/2.5.0
Matthew Petroff pirms 5 gadiem
vecāks
revīzija
59893bcea4
1 mainītis faili ar 10 papildinājumiem un 1 dzēšanām
  1. +10
    -1
      src/js/libpannellum.js

+ 10
- 1
src/js/libpannellum.js Parādīt failu

@@ -321,6 +321,15 @@ function Renderer(container) {
// Create viewport for entire canvas
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);

// Check precision support
if (gl.getShaderPrecisionFormat) {
var precision = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);
if (precision && precision.precision < 1) {
// `highp` precision not supported; https://stackoverflow.com/a/33308927
fragEquiCubeBase = fragEquiCubeBase.replace('highp', 'mediump');
}
}

// Create vertex shader
vs = gl.createShader(gl.VERTEX_SHADER);
var vertexSrc = v;
@@ -1344,7 +1353,7 @@ var vMulti = [

// Fragment shader
var fragEquiCubeBase = [
'precision mediump float;',
'precision highp float;', // mediump looks bad on some mobile devices

'uniform float u_aspectRatio;',
'uniform float u_psi;',


Notiek ielāde…
Atcelt
Saglabāt