Whenever your application isn't processing system messages, it can render a frame of a scene. The Triangle sample renders the scene in the Render3DEnvironment application-defined function called from WinMain whenever the message queue is empty. The Render3DEnvironment function subdivides the task into three substeps: