concept scene in category oculus rift

This is an excerpt from Manning's book Oculus Rift in Action.
In addition to conventional user input, we have another step which fetches the current head pose from the Rift. This is typically used by the application to change how it renders the frame. Specifically, if you’re rendering a 3D virtual environment, you want the view of the scene to change in response to the user’s head movements.
void mainLoop() { while (!quit) { updateState(); ovrHmd_BeginFrame(hmd, frameIndex++); for (int i = 0; i < 2; ++i) { ovrEyeType eye = hmd->EyeRenderOrder[i]; eyePoses[eye] = ovrHmd_GetEyePose(hmd, eye); gl::FrameBufferWrapper & frameBuffer = frameBuffers[eye]; // Render the scene to an offscreen buffer frameBuffers[eye].activate(); renderScene(eyePoses[eye]); #A frameBuffers[eye].deactivate(); } ovrHmd_EndFrame(hmd, eyePoses, eyeTextures); #B } } #A Render each eye to an offscreen buffer #B Pass each rendered image to the SDK for distortion and timewarp
Unity handles just about every aspect of game development, such as the graphics, the audio, the physics, the interactions, and the networking. However, developing for the Rift adds two new tasks to the process: using the head tracker data to change the point of view and properly rendering stereo images to the display. That’s where the Oculus Unity 4 Integration package comes in. The Oculus Unity 4 Integration package includes a stereo camera prefab, that, when used in place of the typical single camera in a scene, handles both of those tasks for you.
If you have not already done so, you should disable or delete any other character controllers and cameras in the scene, such as the OVRPlayerController we used in the last section, or the main default camera if you are using a new scene. Go ahead and give the scene a test run. You will see the Health and Safety warning first. After you press any key to dismiss it, you should see your beach scene (figure 11.12).
Figure 11.12: The scene displayed in the Rift.
![]()