Anroid, GLSurfaceView. Delay between onDrawFrame

Hello! Sorry for my English. I’ve got a problem with understanding of GLThread processing, i think)

I wrote simple graphic engine. It uses 200MB of data that stored in 7 vao(static draw) to draw my scene using only glDrawArrays. onDrawFrame complite in 3-5ms, but between calling of onDrawFrame elapsing up to 60ms, min delay is about 15ms. It makes “freezes” on screen even as rendered scene is very simple. I have only one question: wtf? =) i don’t understand what can happened in GLThread so long. No matter what render type i use, render continuously or when dirty, it looks the same both type. What can i do wrong? Or, maybe, i didn’t make smth necessary… Thanks in advance for any help!

You really haven’t given much to go on here.

Have you verified that the size of the GPU resources you’re using (VBOs, textures, renderbuffers, etc.) isn’t blowing past the amount of available GPU memory?

Are you calling glFinish() or doing something that would cause a full pipeline flush?

Have you brought this up in a GPU profiler to see what’s going on?

Try getting commenting out all of your draw calls to obtain an app that just clears the screen and renders with good performance. Gradually add things. That’ll point out where your problem lies.

Thanks for reply! It was very helpful, cause i haven’t seen anywhere in example glFinish and think that gl call execute write when it called =) But how i can see, it puts in some buffer and executing not the same thread that calls onDrawFrame. That’s ok, i understand where was mistake in measuring render time. Now i measure time from start of one onDrawFrame to start next onDrawFrame. And have many new surprises. For example, with empty onDrawFrame it is called by every 15-17ms. Empty, with no any api calls! Why is it so rarely?

[QUOTE=restangel;1291744]Now i measure time from start of one onDrawFrame to start next onDrawFrame. And have many new surprises.

For example, with empty onDrawFrame it is called by every 15-17ms. Empty, with no any api calls! Why is it so rarely?[/QUOTE]

It sounds like you’re rendering on a 60Hz display with VSync. 60Hz = 16.66ms per frame.

VSync avoids tearing by slowing down the rate at which the frames you render are presented on the screen to once per display cycle. After a frame or two this backs up into your draw loop (onDrawFrame), slowing it down to the same rate. This also has the effect of saving CPU and GPU cycles rendering frames that will never be displayed.