Skip to content

check for webgl support #45

@JohnRDOrazio

Description

@JohnRDOrazio

I recently came across a situation where a PC did not have support for webgl (either webgl wasn't enabled in the browser, or the PC didn't have a graphics card that supports webgl).

Rather than seeing a big red error that makes it look like the codebase has errors, we should do a check for webgl support, and only continue if webgl is supported. If it's not, show a message indicating that webgl support is required for this project to function correctly.

Example check for WebGL support:

      // Get WebGLRenderingContext from canvas element.
      const gl =
        canvas.getContext("webgl") || canvas.getContext("experimental-webgl");

      // Report the result.
      const webglSupportMessage =
        gl instanceof WebGLRenderingContext
          ? "Congratulations! Your browser supports WebGL."
          : "Failed. Your browser or device may not support WebGL.";

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions