GithubHelp home page GithubHelp logo

pixelscommander / isantialiasingsupportedforwebgl Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 20 KB

gl.antialias=true does not guarantee it is actually going to be ON because browser accepts antialias attribute just as a hint and decides on itself there. This library checks for actual AA availability.

Home Page: http://pixelscommander.com/polygon/aatest/demo/

JavaScript 100.00%
webgl antialiasing detection support

isantialiasingsupportedforwebgl's Introduction

Is Antialiasing Supported? For WebGL Image of check sign

You probably heard about WebGL context antialias property. The interesting fact is that having true as a value there does not guarantee antialiasing to be actually enabled. It works just as a hint for browser but there are many reasons it might be disabled and you d like to react on this. For example by enabling shader-based FSAA.

With this library you can actually check if AA works for this machine. Once executed it adds window.antialiasingSupported: boolean property which is true if AA is available.

Demo

Usage

npm install isantialiasingsupported

include into your project and after you may check for

if (window.antialiasingSupported) ...

How this works?

Library creates tiny detached canvas and draws triangle on it with WebGL.

Image of Yaktocat

If triangle have any pixels except white and black then it is antialiased and window.antialiasingSupported is set to true.

License

MIT: http://mit-license.org/

Copyright 2018 Denis Radin aka PixelsCommander

Credits

Inspired by my work at Evolution Gaming

isantialiasingsupportedforwebgl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.