How to save framebuffer as an image

This topic contains 2 replies, has 2 voices, and was last updated by  hnyk 8 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #29768



    I have found few functions (PVRShellScreenCaptureBuffer, PVRShellScreenSave and PVRShellWriteBMPFile)
    that could probably be used to do this, but I don’t know how to use them. The documentation is quite poor and I didn’t find any examples from the tutorials so could somebody please explain with as much detail as possible how to use them. And as you might have guessed, I’m a complete newbie :).



    Well, what you’ll want to do is create a buffer of data, copy the frame buffer into it, then save that to a file.

    GLubyte data = new GLuint[width*height*3]; //size of image multiplied by 3 for the red, the green and the blue

    glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE,data); //copies the data from the frame buffer to your pointer

    PVRShellWriteBMPFile(“testscreen.bmp”, width, height, data); //creates the bitmap file

    delete [] data; //free the memory after

    So you’ll need to put that code somewhere after the drawing of the scene, like at the end of a render function.



    Thanks for the swift answer :).

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.