Answer the question
In order to leave comments, you need to log in
Why is WebGL so slow (with empty shader)?
The vertex and fragment shaders are empty:
attribute vec3 a_position;
void main() {
gl_Position = vec4(a_position, 1.0);
}
void main() {
gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);
}
const triangle_strip = new Float32Array([
-1.0, 1.0, 0.0,
1.0, 1.0, 0.0,
-1.0,-1.0, 0.0,
1.0,-1.0, 0.0,
]);
const buf_triangle_strip = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buf_triangle_strip);
gl.bufferData(gl.ARRAY_BUFFER, triangle_strip, gl.STATIC_DRAW);
gl.vertexAttribPointer(loc_a_position, 3, gl.FLOAT, false, 0, 0);
gl.enableVertexAttribArray(loc_a_position);
render();
function render() {
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
requestAnimationFrame(render, canvas);
}
Answer the question
In order to leave comments, you need to log in
(although it is also copied to the GPU, but again, 60 times).
Would you like to see the source code for the webgl Quake project?
https://habrahabr.ru/post/177159/
Windows limits fps to 60 for webgl, and in general for opengl and direct3d.
I did not deal with webgl, but most likely you can find out in the old fashioned way how many milliseconds it takes to draw one frame and so find out the approximate fps using the formula
1000/количество_миллисекунд_на_отрисовку_одного_кадра
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question