But I can’t set the viewPort’s clear color buffer to false because i’m using the oculus rift which requires it to be true.
Is there any other way I could create a background from an image? or maybe a way I could do the above but with clear color buffer to true?
Well I’m trying to put a changing image from a camera on it from the leap motion on it so you see what is in front of you so it wouldn’t be a static image.
I tried to create a quad like you suggested before but when using the OVRApplication it doesn’t show up. But a Box with 0f as the z size works. But now the problem is how do I transfer from pixels from cam.getWidth() to world Units?
Thanks guys, I figured it out xD
This is how I created one for camera named cam with a Material named backMat.
EDIT:
You have to use the derived fovY for the camera because the oculus rift’s 110 degrees is too large
EDIT 2:
It’s more acurate to calculate the fovX as well instead of the aspect of the camera size
[java]
// Frustums Used
float top = cam.getFrustumTop();
float right = cam.getFrustumRight();
float near = cam.getFrustumNear();
float far = cam.getFrustumFar();
My only problem now is that I would like to set an object to for each of two different viewports like rickard suggested but when I do I get an error saying “State was changed after rootNode.updateGeometricState() call. Problem Spatial: cameraNodeLeft”
Is there anyway I could fix that?
EDIT:
cameraNodeLeft is the node following the camera of the left ViewPort that the background on the left is attached to.
Thanks a lot!
I didn’t end up using the RootNodeAppState you made but it helped me to figure out i just had to add
[java]
cameraNodeLeft.updateLogicalState(tpf);
cameraNodeLeft.updateGeometricState();
to the end of my simpleUpdate method. Thanks again
EDIT:
I was defining the backgrounds in the simpleUpdate since the OVRAppState had to be initialized to get the viewPorts but i just used the default camera to create them in the simpleInitApp method and added the to the viewPorts in the simpleUpdate method since they wouldn’t show up if I created them in the simpleUpdate method.