Comments (4)
MDN also says that there is a function "getShaderPrecisionFormat()" that can check if highp precision is supported.
So I guess you'd need to fork the component and add some code that tests if highp precision is supported. You could also try using mediump instead of highp (although this may result in degraded quality or corruption).
from aframe-bmfont-text-component.
Hi!
I made this test on early stage on my app to, in case of, redirect the user to a limited experience version:
function pixelShader() {
var support = true;
try {
var canvas = document.getElementsByTagName('canvas')[0]
var gl = canvas.getContext("webgl")
var shaderType = [gl.VERTEX_SHADER,gl.FRAGMENT_SHADER]
var precisionType = [gl.LOW_FLOAT, gl.MEDIUM_FLOAT, gl.HIGH_FLOAT, gl.LOW_INT, gl.MEDIUM_INT, gl.HIGH_INT]
shaderType.forEach(function(shader){
precisionType.forEach(function(precision){
gl.getShaderPrecisionFormat(shader,precision)
})
})
} catch (error) {
if (error)
{
support = false;
}
}
return support;
}
Where do you think i could integrate this in your component? Let me try and if it looks fine i'll send you a PR.
from aframe-bmfont-text-component.
Changing the precision used by the fragment shader can be done by adding a parameter here. Try testing with precision: "mediump"
.
var material = new THREE.RawShaderMaterial(SDFShader({
precision: "mediump",
map: texture,
side: THREE.DoubleSide,
transparent: true,
color: data.color,
opacity: data.opacity
}));
If that fixes the problem on mobile let me know and I'll try to help with integrating the test.
P.S.
I've just discovered that Three.js' WebGL renderer has a "capabilities" property that contains a method getMaxPrecision(). Might be useful.
from aframe-bmfont-text-component.
Closing as this issue has been open for quite some time and I'm about to archive this project.
from aframe-bmfont-text-component.
Related Issues (20)
- Text primitive is terribly buggy HOT 3
- Helvetica as default HOT 3
- Text is not influenced by fog
- Does this work with aframe react? HOT 2
- Position of text feels offset compared to normal entities position HOT 5
- Issue when deployed on remote server? HOT 1
- Handle updates more performantly HOT 3
- Embedding in Wordpress HOT 1
- Version releases
- Animating opacity crashes WebGL after looping a few times HOT 2
- Placement with variable length text. HOT 9
- Uncaught TypeError: Cannot read property 'getMeshMixin' of undefined(…) HOT 2
- How to support display Chinese HOT 2
- Way to cache fntImage? HOT 4
- [Feature Request] Vertical align text? HOT 4
- Can't dynamically change the attribute's value HOT 1
- Opacity does not work HOT 1
- can this support Chinese?How? HOT 2
- MSDF Shader
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aframe-bmfont-text-component.