SceneKit node(s) with a render delegate causes all sorts of display issues


#1

I recently ported an app from using Cocos2D to SceneKit, and needed to port the old particle emitter engine as it. I achieved this by implementing a custom SceneKit node with a render delete, using a GLKBaseEffect and then dropping into OpenGL calls (e.g. create a VBO, vertex arrays, draw, etc). All of this works fine both in a SCNView, as well as in Google Cardboard’s multiple SCNRenderer configuration. When implemented inside the Bridge engine, however, the call to glDrawElements (!!) causes all sorts of visual issues, and commenting out that one line eliminates the visual issues (but obviously also removes what I’m trying to draw).


#2

Sounds like some GL state didn’t get reset to the way they were. The BridgeEngine rendering stack directly drives the SceneKit rendering engine, so when using a SCNRenderer callback we have to be careful that when states get modified that they are also restored, or could lead to later stages of rendering getting mucked up. Is it possible to set up a minimal project with particle system like you’re doing? Would be good to see what states are impacted, and if there’s some way to globally restore states, or at least guard against these cases.


#3

just to close this up, Bridge engine has its own EAGLContext, so currently I must tear down and recreate all of my GL objects, including VBOs, textures, etc using their context and share group.