patriciogonzalezvivo / glslCanvas

Simple tool to load GLSL shaders on HTML Canvas using WebGL
http://patriciogonzalezvivo.github.io/glslCanvas/
MIT License
1.99k stars 183 forks source link

Wrongly unsupported WebGL message #49

Closed elmatou closed 4 years ago

elmatou commented 5 years ago

Hi everyone,

I was trying to setup the lib for one of my project. but while trying to use the librairy à constently get the folling message on my webpage : "It does not appear your computer can support WebGL...."

I tried with chromium and firefox, on linux and android and got the same error. while reading "the book of shaders" every samples and examples seem to work fine on the same browser I got the error.

It works even with the following test : https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/By_example/Detect_WebGL

First, I'm wondering what I'm doing wrong ? Second It seems the error message is not very useful and do not provide a lot of information.

I'm using the lib with these lines :

<canvas id="my-sketch" data-fragment-url="./resources/frag/sketch.frag" width="300" height="300"></canvas> //same issue with no data-fragment
    <script src="glslCanvas/GlslCanvas.min.js"></script> // same issue when pointing to github hosted file.
const buffer = document.getElementById('my-sketch');
const sandbox = new GlslCanvas(buffer);

Any guess ?

elmatou commented 5 years ago

I'll respond to myself to the first question.

I was triyng to use a canvas, already set with a 2D context because it was filled with a webcam capture.

  buffer.getContext('2d').drawImage(video, 0, 0);

the canvas used by GlslCanvas should be clean of this to work.

But really debugging was a bit long without an explicit error from GlslCanvas.