How to render level sequence with png by c++

I want to render a given level sequence with png by c++,now I can play level sequence, but i don’t know how render and capture.