Closed ljfdestiny closed 8 years ago
Hi Ijfdestiny, I have been trying render an SCNScene into GLKView's EAGLContext using the SCNRenderer, but it only renders black. I made a SceneKit replacement for the TreasureRenderer in the sample code as a test. The same scene renders into an SCNView, even one using the same EAGLContext.
- (void)setupRendererWithView:(GLKView *)glView
{
[EAGLContext setCurrentContext:glView.context];
self.renderer = [SCNRenderer rendererWithContext:glView.context options:nil];
self.renderer.scene = self.scene;
...
Did you manage to get a scene rendered into the Cardboard EAGLContext?
Hi CacheLine,maybe you forgotten to call [renderer render] in drawEyeWithEye:(CBDEye *)eye ?
Thanks Ijfdestiny, I just triple checked. Nothing as easy as that :-( I had also tried calling [renderer renderAtTime:] since they say [renderer render] is deprecated. It didn't help.
How about the view matrix and perspective of the cameraNode,did you tramsform then to SCNMatrix format?
(void)drawEyeWithEye:(CBDEye *)eye { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
_view = GLKMatrix4Multiply([eye eyeViewMatrix], _camera); _perspective = [eye perspectiveMatrixWithZNear:_zNear zFar:_zFar];
cameraNode.transform = SCNMatrix4FromGLKMatrix4(GLKMatrix4Transpose(_view));
[cameraNode.camera setProjectionTransform:SCNMatrix4FromGLKMatrix4(_perspective)];
[_renderer render]; }
Thank you IjfDestiny! I was neglecting the glClear, without which everything was black. I also missed the setProjectionTransform, and most annoyingly, the use of the transpose of the GL matrix to get the node transform. Thank you again
It seems this have been resolved. Can this issue be closed? :)
I'm closing this issue now, let me know if there are any more issues.
In case it helps, a CBDSceneKit
example project has just been added, demonstrating usage of the CardboardSDK with SceneKit+SpriteKit.
Hi @rsanchezsaez ,thanks for providing a terrific framework to us. Now i want to move the code to Scenekit.But I met problems with Scenekit + CardboardSDK-iOS.In my code i use SCNRenderer to match with CBDViewController's openGL Context.But the [SCNRenderer render] function is deprecated: deprecated in iOS 9.0.And Particle Effects can not show correctly. So,is there possible to change the project to Scenekit? Thanks.