3

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?)

zzyzy
  • 973
  • 6
  • 21
  • Concerning SKScene's context property: "You may be wondering why it is better to use this property rather than simply adding an SKView as a subview of the SCNView object. When the overlaySKScene property is used, both the 2D and 3D components of your app use the same OpenGL context to render content onto the screen. This performs significantly better than creating two separate views, which would each have their own OpenGL context and rendering pipeline." https://medium.com/@kashani/there-is-actually-a-way-to-guarantee-harper-s-defeat-here-s-how-11ca79cec748 – zzyzy Oct 08 '15 at 13:37

0 Answers0