# Can I use shaders with electron and p5js?

**URL:** https://discourse.processing.org/t/can-i-use-shaders-with-electron-and-p5js/24444
**Category:** Coding Questions
**Created:** [October 8, 2020, 5:09pm UTC](https://discourse.processing.org/t/can-i-use-shaders-with-electron-and-p5js/24444 "2020-10-08T17:09:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![stephanschulz](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@stephanschulz](https://discourse.processing.org/u/stephanschulz)
#### Post date: [October 8, 2020, 5:09pm UTC](https://discourse.processing.org/t/can-i-use-shaders-with-electron-and-p5js/24444/1 "2020-10-08T17:09:59Z")

</div>

I am able to run this template, which create an electron app with p5js code.

> **[garciadelcastillo/p5js-electron-templates](https://github.com/garciadelcastillo/p5js-electron-templates)**
>
> A set of p5.js templates that run as Electron apps. - garciadelcastillo/p5js-electron-templates

But as soon as I add shader loading the app displays a black window. Everything works fine when running the same code through Brackets as a normal javascript website.

So maybe shaders and WEBGL do not work in electron?

```auto
theShader = loadShader("shader.vert", "shader.frag");

```

---

<div class="post-metadata">

### Author: ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)
#### Post date: [October 8, 2020, 6:17pm UTC](https://discourse.processing.org/t/can-i-use-shaders-with-electron-and-p5js/24444/2 "2020-10-08T18:17:30Z")

</div>

I think it really depends on your platform/browser. Phones are getting better and better, but I don’t think WebGL has reliable coverage yet.

> **[Can I use... Support tables for HTML5, CSS3, etc](https://caniuse.com/webgl2)**

---

<div class="post-metadata">

### Author: ![stephanschulz](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@stephanschulz](https://discourse.processing.org/u/stephanschulz)
#### Post date: [October 8, 2020, 7:21pm UTC](https://discourse.processing.org/t/can-i-use-shaders-with-electron-and-p5js/24444/3 "2020-10-08T19:21:24Z")

</div>

Thanks for your reply.

I am on macOS trying to make an app for macOS.

Are you saying electron can’t do WebGL? Do I really need webGL to use shaders with p5js in electron?

---

<div class="post-metadata">

### Author: ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)
#### Post date: [October 9, 2020, 4:20am UTC](https://discourse.processing.org/t/can-i-use-shaders-with-electron-and-p5js/24444/4 "2020-10-09T04:20:17Z")

</div>

Oh my bad, totally forgot what electron was for a second.

Unfortunately, this was the best my google-fu came up with. Sorry I couldn’t be more helpful 😅

> **[zamronypj/webgl-electron](https://github.com/zamronypj/webgl-electron)**
>
> WebGL electron-based desktop application. Contribute to zamronypj/webgl-electron development by creating an account on GitHub.
