Skip to content

Commit

Permalink
use high precision in shaders
Browse files Browse the repository at this point in the history
The medium precision shader was causing problems for rendering with
outline mode on the iPad. The whole structure would appear in black.
This fixes biasmv#62.
  • Loading branch information
biasmv committed Nov 29, 2014
1 parent 63a0d90 commit 5698a11
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/shaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exports.shaders = {};

// line fragment shader, essentially uses the vertColor and adds some fog.
exports.shaders.LINES_FS = '\n\
precision mediump float;\n\
precision highp float;\n\
\n\
varying vec4 vertColor;\n\
varying vec3 vertNormal;\n\
Expand All @@ -48,7 +48,7 @@ void main(void) {\n\

// hemilight fragment shader
exports.shaders.HEMILIGHT_FS = '\n\
precision mediump float;\n\
precision highp float;\n\
\n\
varying vec4 vertColor;\n\
varying vec3 vertNormal;\n\
Expand Down Expand Up @@ -90,7 +90,7 @@ void main(void) {\n\

// outline shader. mixes outlineColor with fogColor
exports.shaders.OUTLINE_FS = '\n\
precision mediump float;\n\
precision highp float;\n\
varying float vertAlpha;\n\
\n\
uniform vec3 outlineColor;\n\
Expand All @@ -113,7 +113,7 @@ void main() {\n\
// outline vertex shader. Expands vertices along the (in-screen) xy
// components of the normals.
exports.shaders.OUTLINE_VS = '\n\
precision mediump float;\n\
precision highp float;\n\
\n\
attribute vec3 attrPos;\n\
attribute vec3 attrNormal;\n\
Expand All @@ -132,7 +132,7 @@ void main(void) {\n\
}';

exports.shaders.TEXT_VS = '\n\
precision mediump float;\n\
precision highp float;\n\
\n\
attribute vec3 attrCenter;\n\
attribute vec2 attrCorner;\n\
Expand All @@ -148,7 +148,7 @@ void main() { \n\
}';

exports.shaders.TEXT_FS = '\n\
precision mediump float;\n\
precision highp float;\n\
\n\
uniform mat4 projectionMat;\n\
uniform mat4 modelviewMat;\n\
Expand All @@ -161,7 +161,7 @@ void main() { \n\
}';

exports.shaders.SELECT_VS = '\n\
precision mediump float;\n\
precision highp float;\n\
uniform mat4 projectionMat;\n\
uniform mat4 modelviewMat;\n\
attribute vec3 attrPos;\n\
Expand All @@ -175,7 +175,7 @@ void main(void) {\n\
}';

exports.shaders.SELECT_FS = '\n\
precision mediump float;\n\
precision highp float;\n\
\n\
varying float objId;\n\
uniform int symId;\n\
Expand Down

0 comments on commit 5698a11

Please sign in to comment.