How are people including WebGL shaders in Wordpress?
The most common way to use shaders is to use <script id="shader-fs" type="x-shader/x-fragment">
tags in HTML files. It is problematic to include script tags in posts or pages. The type is important, so they can't be enqueued like regular javascript files.
From this Stackoverflow page, the files can be dynamically loaded, but this would require placing files somewhere in Wordpress that could be directly linked.
A third option is to just include the shader source code as a long variable string. This is the most direct method, but it makes using createShaderFromScript
methods not work.
What other methods are available for using WebGL shaders in Wordpress?
Aucun commentaire:
Enregistrer un commentaire