How to take screenshot in OpenGL

前端 未结 7 771
终归单人心
终归单人心 2020-12-01 04:59

How to take a screenshot of an OpenGL window in C++ and save it to file.

I found the glReadPixels() function, but I don\'t know what to do next. Where I can set path

7条回答
  •  Happy的楠姐
    2020-12-01 05:11

    glReadPixels will copy the bits into a memory buffer that you supply. You have to manually format the data (to the image format of your choice) and write it to disk after glReadPixels returns.

提交回复
热议问题