In OpenGL, to keep program rendering frames I need a while
loop, all the code that put inside the loop is executed every loop. The loop looks like this:
while(!glfwWindowShouldClose(window))
{
// Check and call events
glfwPollEvents();
// Rendering commands here
...
// Swap the buffers
glfwSwapBuffers(window);
}
Now I'm jumping into OpenGL ES and trying to learn from this example:
https://github.com/googlesamples/android-ndk/tree/master/gles3jni
However, I couldn't find any while
or for
loop in the code. Instead, There're something else likes extending the GLSurfaceView
and implementing the GLSurfaceView.Renderer
. I don't really get how it works.
Therefore, I wonder how the iteration goes every time it render a frame? Is every thing written in the .cpp file executed every loop or just functions that being called by the JNI? And once It finish rendering the very first frame, where does it start at the beginning of the 2nd loop? Your attention and help is very much appreciated.