Another fix is to put event loop after pgl_image.blit()
, so that PGLGL.show()
renders the newest frame now.
Before, it renders last frame. What is worse, If agent_render_variant
is AgentRenderVariant.ONE_STEP_BEHIND
, it renders two frames behind.
Window size of pgl was fixed before, irrelavent to the rendered PIL image size, and thus lead to distortion. What is more, resizing PIL image to fit window size relies on interpolation, which leads to poor rendering quality. Here we let the window size to be same as the rendered PIL image size to avoid distortion and resizing.