question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is WebGL 2 supported yet?

See original GitHub issue

I’m using the latest version of PIXI, and want to upgrade an existing frag shader to use WebGL 2. I cannot find any documentation for doing this with PIXI 6, and the issues I found were closed by the bot without a conclusion.

I tried this frag shader (using the default vert shader):

#version 300 es

in vec2 vTextureCoord;
uniform sampler2D uSampler;
out vec4 color;

void main(void) {
    color = texture(uSampler, vTextureCoord);
}

This is the (primary) error:

ERROR: 0:3: 'version' : #version directive must occur before anything else, except for comments and white space

Can I use a WebGL 2 frag shader in a PIXI 6 filter?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
dev7355608commented, May 28, 2022

@frankandrobot You pass undefined , which defaults to the standard version 100 vertex shader regardless of whether PREFER_ENV is WEBGL2: new Filter(undefined, frag, .... You need to pass the version 300 vertex shader posted above. Both the vertex and the fragment shader must be the same version.

2reactions
andrewstartcommented, Mar 10, 2022

The renderer can be set to pick WebGL 2 if available with PIXI.settings.PREFER_ENV = PIXI.ENV.WEBGL2 I don’t do filter stuff myself, so couldn’t tell you if Pixi will have any issues with the shaders.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebGL 2.0 | Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
Your browser supports WebGL2
Your browser supports WebGL2. You should see a spinning cube. If you do not, please visit the support site for your browser.
Read more >
Browser Compatibility Testing of WebGL 2.0 - LambdaTest
BROWSER SUPPORT FOR WebGL 2.0 · Google Chrome · Mozilla Firefox · Internet Explorer · Safari · Microsoft Edge · Opera.
Read more >
How to use WebGL2
As of September 2021, WebGL2 is available in the latest versions of Chrome, Edge, Firefox, Safari and Opera. Note that in Safari WebGL2...
Read more >
WebGL 2.0 is Now Supported in All Major Browsers - 80 Level
The Khronos Group announced that WebGL 2.0, which renders interactive 2D and 3D graphics without using plug-ins, is now supported in all ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found