Identify the ANGLE using JavaScript

I'm experiencing an issue with my WebGL / Three.js game where there is an unhelpful shader program linking error when ANGLE is used for providing WebGL. To address this, I am looking to implement a prominent warning specifically for ANGLE users on the homepage, along with instructions on how to switch to the native OpenGL renderer. Additionally, I want to automatically disable shadows if the user does not make the switch to native GL.

The challenge lies in detecting shader failures and identifying if ANGLE is being used. One approach I am considering is using the following approximation:

IF Windows AND ( Chrome OR Firefox ) THEN displayWarning()

Are there any alternative suggestions or solutions that might work better?

Answer №1

Give this a try, it's been successful for me.

let _IS_ANGLE_ACTIVE = false;
...
...
let renderer = new THREE.WebGLRenderer( {  antialias: true  });
...
...
let ctx = renderer.domElement.getContext("webgl");
if (ctx==null)
    ctx = renderer.domElement.getContext("experimental-webgl");
if (ctx) {
    let h = ctx.getParameter(ctx.ALIASED_LINE_WIDTH_RANGE);
    _IS_ANGLE_ACTIVE = (h && h.length==2 && h[0]==1 && h[1]==1);
}

The variable h will return [1,1] if ANGLE is active or something similar like [1,10] with native GL.

Answer №2

Do you think it's possible to use WebGL without revealing too much information about the GPU?

If there are issues with readpixels, maybe creating a simple test case to highlight the problem could be helpful for troubleshooting purposes

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Firing a custom jQuery event when a page loaded via AJAX is complete, ensuring it is triggered

I am facing an issue with a particular scenario. There is a page that contains a script to load a child page and log a custom event, which is triggered in a Subform. --Index.html-- <body> <input type="button" class="clickable" value="Load child ...

MUI-Datatable: Is there a way to show the total sum of all the values in a column at once

I have a column displaying the Total Amount, and I am looking for a way to show this totalAmount. After conducting some research, it seems like onTableChange is the key. Currently, it effectively displays all of the data using console.log("handleTab ...

Creating an expo apk using eas buildWould you like a tool for generating

Following an update to Expo, the process of building apk files using expo build:android -t apk is no longer supported. Instead, it now recommends using eas builds with the command eas build -p android --profile preview. However, this resulted in building a ...

Guide on resizing a ReactJS component for optimal browser display

Is there a way to resize a pre-existing React component within a browser that already has predetermined height and width? componentDidMount(x,y,z){ this.setState({height:window.innerHeight+'px'}); } I'm unsure if this approach is the corr ...

JavaScript generated form fails to submit

I am currently facing an issue with submitting form data to a PHP file when it is generated using JavaScript. I am unsure of how to resolve this problem. The form submission works fine on a test .html file by itself, but not when it is generated by JavaScr ...

Navigate to a specific position with a single click by accessing a class from another Vue component

Clarification of the issue When a user clicks on the login link, the view should automatically scroll down to the login window where they can input their credentials. I know how to achieve this in a single file using document.getElementById('login-w ...

Sending a null value through AJAX to a controller

I've been working on adjusting my save routine to pass a null value to id_cellcarrier in my codeigniter controller. The code snippet below showcases what I've attempted so far, but it doesn't seem to be functioning correctly. I'm omitti ...

Selenium and JavaScript integration for opening new browser tabs

Hello there, I am looking to open new tests ('it' method) in new tabs and currently trying this approach: driver = new Builder().forBrowser('chrome').build(); beforeEach(() => { // driver.manage().window().open('url') ...

Enhance user experience with Google Optimize by conducting A/B testing on

I am seeking advice on Google Optimize CSS code. My goal is to perform A/B testing on button colors throughout my entire WordPress website at www.interica.si. When I make changes to the CSS code in the edit mode, it seems to affect all buttons, but when I ...

Custom validation on the client side using ASP.NET and JavaScript WebMethods

I am encountering an issue with client-side validation using a JavaScript function. On my ASP.NET C# page, I have a WebMethod that successfully validates data entered by the user. The page includes a textbox with an AJAX AutoCompleteExtender, which is work ...

Jquery not functioning properly after invoking window location change

I have a function that sends a value to a php page and then executes some sql. Once the process is finished, I want to change the window location. Everything works fine without the window.location.href line, but when I include it, the page changes without ...

Importing components in real-time to generate static sites

My website has a dynamic page structure with each page having its unique content using various components. During the build process, I am statically pre-rendering the pages using Next.js' static site generation. To manage component population, I have ...

Discover the unique value in Angular if it is not present in the list

I have a question about handling values in a list and displaying the "create value" component to the user when needed. How can I efficiently compare search input values with those in the list and determine if a match exists? If no match is found, the "cr ...

How to Override package.json Scripts in NPM

Is it possible to modify package.json scripts without changing the original file? I need to customize the memory allocation for a specific step, but altering the package.json will affect everyone. For example, our current script is: "script": { "dev": ...

Sometimes jQuery may require multiple executions with just one click

Content of index.php <script type="text/javascript" src="//<?php echo $_SERVER["SERVER_NAME"];?>/javascript/jquery-1.10.2.min.js" ></script> <script type="text/javascript"> $(document).ready(function() { $( document ).on( 'c ...

The error message "window is not defined" occurs when the external file 'signalr.min.js' is included

Updates OpenTest --version 1.2.2 ChromeDriver 85.0.4183.87 Whenever I attempt to add the necessary external javascript files, it results in the following errors: Caused by: java.lang.RuntimeException: Failed to evaluate JavaScript code at line number 1. ...

Typescript on the client-side: what is the best way to eliminate circular dependencies when using the factory method design pattern?

In my code, I have implemented the factory method pattern. However, some instances using this pattern end up with circular dependencies. Removing these dependencies has proven to be a challenge for me. To illustrate, consider the following example: // fact ...

Validating Email Addresses Using JavaScript Regex

As a beginner to regex, I am just trying to validate if ([email protected]) works correctly. This is what I have attempted so far. var checkEmail = /^\w+@\w+\.[a-zA-Z]/; Is the above regex pattern suitable for my validation needs? ...

Sliding the container with a width adjustment and left margin fails to display all images

In the provided HTML code below, there is a functionality to move images horizontally by clicking on buttons: $(document).ready(function() { calculate_width(); $('#moveleft').click(function() { var loga = $('#marki #loga'); ...

Unusual compilation issue encountered in Vue when trying to use a template for a slot

I encountered a strange issue where my Vue compiler was refusing to render the default named slot of a child component. Error: Codegen node is missing for element/if/for node. Apply appropriate transforms first. Even my VSCode highlighted this problem a ...