I want to get access to underlying OpenGL context of a SpriteKit
scene so I can do a glReadPixels
at 30/60fps on it in order to obtain a RGB32 pixel buffer image representation of the scene, as it's rendered.
Ideally, I'd love access to something akin to CVPixelBuffers
whilst the SpriteKit/SceneKit
renders are occuring.
I'm well aware that I can not get access to the underlying OpenGL context on a SpriteKit scene. This has been the case for quite a while.
However, with the introduction of the SceneKit
, there is the possibility of using the SCNSceneRenderer
Protocol which has the OpenGL context property exposed... hmmm.
Now... if I do an overlaySKScene:
call in a SceneKit
's SCNSceneRenderer
, does that effectively allow me gain access to the desired pixel buffer image?
I have little intention of doing anything meaningful in 3D (SceneKit
), but most of my work will be done in SpriteKit
(2D).
Has anyone tried anything like this?
PS: (If using Metal, is SCNBufferSteam
a thing? What about SCNTechnique
?)