Answer the question
In order to leave comments, you need to log in
How to load shaders from the server?
On the client side, there is a js file that contains all the game logic, including vertex and fragment shaders. I want to move the shaders to the server side of Node.js and load them over the network. Question: What is better to use for this - HTTP protocol (XHR/fetch()) or WebSocket?
Answer the question
In order to leave comments, you need to log in
Since the content of the shaders themselves is unlikely to change often, make a separate web worker for them and place them in the cache in preload, and then use HTTP (XHR / fetch) to load them, which will be intercepted by the web worker and returned from the cache.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question