webgl-quake3 icon indicating copy to clipboard operation
webgl-quake3 copied to clipboard

Performance

Open hsreina opened this issue 9 years ago • 1 comments

Well, it's quite not an issue, but you could update some code for performance.

in https://github.com/toji/webgl-quake3/blob/master/js/main.js#L325 document.getElementById('viewport') in drawFrame is maybe not the best thing to do.

in https://github.com/toji/webgl-quake3/blob/master/js/main.js#L455 Should also try to put code like 'W'.charCodeAt(0) in a more global object like

const CharCode = {
    'W': 'W'.charCodeAt(0),
    ...
};

CharCode.W

in https://github.com/toji/webgl-quake3/blob/master/js/main.js#L283 You could put vrPosition.position in a variable too?

But your general code is easy to read and I found nice answer.

hsreina avatar Feb 17 '16 14:02 hsreina

@hsreina If you really look for performance, don't use WebGL. The creator of this demo isn't to blame, he does his best but WebGL is terribly slow on all my machines whereas they are able to run Quake 3, Quake 2, Undead Arena (Java), Jake2 (Java), Red Eclipse, Open Arena, ... without any slowdown. I already know that the culprit is somewhere inside the implementation of WebGL itself, it's still the same problem that has bothered me for years and that has refrained me from using WebGL in my own projects, there is no direct onscreen rendering. If your driver handles FBO poorly, the performance will be bad. If there was a way of using WebGL without offscreen rendeering, it would be a lot faster on numerous laptops and on low end hardware in general.

ghost avatar Aug 18 '17 14:08 ghost