love.js supports shader?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
love.js supports shader?
as the title, does love.js supports shaders? if not, any way to port the project on web platform?Thanks.
- jojomickymack
- Prole
- Posts: 45
- Joined: Tue Dec 26, 2017 4:52 pm
Re: love.js supports shader?
I just did a quick test and the answer is yes, love.js does support shaders.
I attached the love file I used for the test - unzip it, put it in a folder called shader001
download the lovejs repo
https://github.com/TannerRogalsky/love.js
put the shader001 folder in the debug folder of lovejs, make sure you have python2.7 installed, and run the command below
python ../emscripten/tools/file_packager.py game.data --preload ./shader001@/ --js-output=game.js
loading index.html in a browser should show that the shader is being executed by love.js.
seems to work fine with a simple shader like that, however for some of the shader libraries like moonshine or light world I'd be curious to see if it holds up.
I followed this tutorial to create the love2d app.
http://blogs.love2d.org/content/beginners-guide-shaders
I attached the love file I used for the test - unzip it, put it in a folder called shader001
download the lovejs repo
https://github.com/TannerRogalsky/love.js
put the shader001 folder in the debug folder of lovejs, make sure you have python2.7 installed, and run the command below
python ../emscripten/tools/file_packager.py game.data --preload ./shader001@/ --js-output=game.js
loading index.html in a browser should show that the shader is being executed by love.js.
seems to work fine with a simple shader like that, however for some of the shader libraries like moonshine or light world I'd be curious to see if it holds up.
I followed this tutorial to create the love2d app.
http://blogs.love2d.org/content/beginners-guide-shaders
- Attachments
-
- shader001.love
- (466.16 KiB) Downloaded 116 times
- jojomickymack
- Prole
- Posts: 45
- Joined: Tue Dec 26, 2017 4:52 pm
Re: love.js supports shader?
I continued looking into this since and concluded that I could not get moonshine (https://github.com/vrld/moonshine/), lightworld (https://github.com/tanema/light_world.lua) or shadows (https://github.com/matiasah/shadows) to work with love.js.
I also realized that I'd used the master branch for love.js in my previous message, and that there's an npm package that is completely different, probably better - if someone is looking to use that, I discovered that it's incompatible with node 6.11.3, but works fine with node 8.9.4. Just type npm install -g love.js, and you'll be able to use it anywhere. To build a love file, the command is
love.js input.love outputfolder
not surprisingly, none of the listed libraries worked using love.js 0.11 - but to my surprise, my original test failed to execute the shader too - it displayed a pink and blue color instead of applying the shader and there's an error in the console 'pthreads are not available'.
https://github.com/TannerRogalsky/love.js/issues/57
It's also worth mentioning that I was using firefox and I couldn't get any shaders at all to execute with love.js with any other browsers.So unfortunately shader support with love.js is actually not that great.
---
follow up
TannerRogalsky explained in the issue:
The master branch of this repo was not compiled with threads enabled. It's one of the major differences with the new version that I've got threads enabled and working.
But you will require a browser with SharedArrayBuffers enabled. Your version of Firefox supports them but they are disabled by default because of a recent cybersecurity threat. https://www.mozilla.org/en-US/security/ ... sa2018-01/
Nothing I can do about that, unfortunately. Time will, hopefully, stabilize these required features.
---
so I the real answer to the question is that love.js 0.11 does support shaders.
I also realized that I'd used the master branch for love.js in my previous message, and that there's an npm package that is completely different, probably better - if someone is looking to use that, I discovered that it's incompatible with node 6.11.3, but works fine with node 8.9.4. Just type npm install -g love.js, and you'll be able to use it anywhere. To build a love file, the command is
love.js input.love outputfolder
not surprisingly, none of the listed libraries worked using love.js 0.11 - but to my surprise, my original test failed to execute the shader too - it displayed a pink and blue color instead of applying the shader and there's an error in the console 'pthreads are not available'.
https://github.com/TannerRogalsky/love.js/issues/57
It's also worth mentioning that I was using firefox and I couldn't get any shaders at all to execute with love.js with any other browsers.
---
follow up
TannerRogalsky explained in the issue:
The master branch of this repo was not compiled with threads enabled. It's one of the major differences with the new version that I've got threads enabled and working.
But you will require a browser with SharedArrayBuffers enabled. Your version of Firefox supports them but they are disabled by default because of a recent cybersecurity threat. https://www.mozilla.org/en-US/security/ ... sa2018-01/
Nothing I can do about that, unfortunately. Time will, hopefully, stabilize these required features.
---
so I the real answer to the question is that love.js 0.11 does support shaders.
Who is online
Users browsing this forum: No registered users and 3 guests