I'm writing single threaded game engine for 2D games. Right now my game loop looks rougly like this:
- Update game logic
- Update physics
- Handle collisions
- Render scene
I'm using OpenGL for rendering. I'm wondering about 'Render scene' step position in game loop. There is a SwapBuffers() call on the end of the 'Render scene' step, so CPU is blocked until all rendering is finished. What do you think about this game loop:
- Render scene (previous frame)
- Logic, physics, collisions
- Swap buffers
This approach will bring better parallelism between CPU and GPU. Am I right?