A
A
AndreyMasalov2018-03-05 18:51:01
WebGL
AndreyMasalov, 2018-03-05 18:51:01

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

1 answer(s)
V
Vladimir Skibin, 2018-03-05
@megafax

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 question

Ask a Question

731 491 924 answers to any question