Replies: 1 comment 1 reply
-
I haven't tested too many shaders, but in theory they should work. Here is a sample snippet about how to load the crt-easymode shader by writing shader files: await Nostalgist.launch({
core: 'fceumm',
rom: 'flappybird.nes',
async beforeLaunch(nostalgist) {
const FS = nostalgist.getEmscriptenFS()
const glslp = await fetch('https://cdn.jsdelivr.net/gh/libretro/glsl-shaders/crt/crt-easymode.glslp')
const glsl = await fetch('https://cdn.jsdelivr.net/gh/libretro/glsl-shaders/crt/shaders/crt-easymode.glsl')
// Put all shader files into shaders/shaders_glsl directory
FS.mkdirTree('/home/web_user/retroarch/bundle/shaders/shaders_glsl/shaders/')
FS.writeFile('/home/web_user/retroarch/bundle/shaders/shaders_glsl/crt-easymode.glslp', await glslp.text())
FS.writeFile('/home/web_user/retroarch/bundle/shaders/shaders_glsl/shaders/crt-easymode.glsl', await glsl.text())
// Enable the shader in the global shader config file config/global.glslp
FS.mkdirTree('/home/web_user/retroarch/userdata/config/')
FS.writeFile(
'/home/web_user/retroarch/userdata/config/global.glslp',
'#reference /home/web_user/retroarch/bundle/shaders/shaders_glsl/crt-easymode.glslp',
)
},
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The API reference about shaders says:
“This parameter is used for simple shaders only. For some complicated cases, you might need to use the beforeLaunch parameter to write the shader files into the file system.”
Does it mean that every GLSL shader should work in webgl environment, assuming all the required files will be loaded?
And could you please consider posting a sample code?
Beta Was this translation helpful? Give feedback.
All reactions