Forum

JS Error on OS

12 January 2015 20:24
I am getting the JS error on the follow spec:

Safari: 5.1.10

OS: 10.6.8

WebGL enabled

Js Error: TypeError: 'undefined' is not a function (evaluating 'a.getShaderPrecisionFormat(a.FRAGMENT_SHADER, a.HIGH_FLOAT)')

It just stopped on the preload screen (Blend4Web's API Simple Preloader).
12 January 2015 20:38
Hi Ryan,

That is rather old version of Safari, and it is quite possible that its WebGL implementation does not support some functionality from the Khronos spec, such as getShaderPrecisionFormat() function. Officially, WebGL is supported since OS X Yosemite, Safari version 8.0. Do you have opportunity to upgrade your browser and/or Snow Leopard? If not you might download Chrome of Firefox.
The Founder | Twitter | Facebook | Linkedin
12 January 2015 20:55
We'll be setting up an error message prior to initializing Blend4Web. We'll check the browser version first.
12 January 2015 20:56
Here's a list of all the browsers and their versions that support WebGL.

http://en.wikipedia.org/wiki/WebGL

12 January 2015 21:04
Since WebGL is disabled by default in Safari before version 8.0 (which is valid for all users who are not WebGL developers), you can safely allow Blend4Web to find it out and to display either an error message or an arbitrary user-defined image.
The Founder | Twitter | Facebook | Linkedin
12 January 2015 22:31
How would I attach the user-defined image if i'm using the data.load method in the API. I'm setting up a file similar to the following tutorial https://www.blend4web.com/en/article/23.
12 January 2015 23:12
The init_cb() callback which is fired after initialization has the second boolean argument (named success). If this value is false, that is no WebGL, an app can show up some hidden HTML content (image, text, video whatever).

For example:
if (!success) {
    var cont = document.getElementById("my_ID"); // get <div> container for fallback content
    cont.style.display = "";
}

Here assumed that the container element exists in your page, but is initially hidden, which can be done with HTML and CSS as follows:
<div id="my_ID">Fallback content here..</div>
<style>
#my_ID {
    display: none;
}
</style>


Edit: added a bit more code to clarify things..
The Founder | Twitter | Facebook | Linkedin
13 January 2015 00:12
This is what we were thinking on doing. Thanks for the help.
13 January 2015 08:11
You're most welcome!
The Founder | Twitter | Facebook | Linkedin
 
Please register or log in to leave a reply.