How do I grab an image from my EAGLLayer ?

后端 未结 3 1830
温柔的废话
温柔的废话 2021-01-06 21:45

I\'m looking for way to grab the content of my opengl (as UIImage) and then save it into a file. I\'m now giving glReadPixels a try though I\'m not sure I\'m doing the right

3条回答
  •  醉梦人生
    2021-01-06 22:14

    All OpenGL|ES complient GL-implementations have to support GL_RGBA as a parameter to glReadPixels.

    If your OpenGL|Es supports the

    GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 
    

    extension you can also query the native format. glReadPixels will understand this format as a parameter to glReadPixels and allows you to directly get the pixel-data in native format. This is usually a bit faster than GL_RGBA.

    Take a look at the header-file or query the extension-support via glGetString.

提交回复
热议问题