concept aspect ratio in category oculus rift

appears as: n aspect ratio, spect ratios, aspect ratio, spect ratio
Oculus Rift in Action

This is an excerpt from Manning's book Oculus Rift in Action.

  • • The DK 2 Rift has an aspect ratio of 16:10. So a 1920x1080 image sent to the Rift will appear vertically stretched very slightly, compared to how it would appear on a conventional 1920x1080 monitor. This means that you must always use the native resolution of the Rift when calculating aspect ratios, regardless of the resolution of the image or video being sent to it.
  • Making assumptions about the aspect ratio of the screen

    Nearly all UIs seem to make assumptions about the aspect ratio of the screen (at the very least, they’ll often assume that the screen is wider than it is tall) which don’t hold in the Rift.  Aspect ratios as a whole are a real red herring in Virtual Reality: if there’s no width or height to the screen (the user can just turn their head to see more ‘screen’) then there aren’t any ratios between width and height either.  

    Listing 13.5 WebcamApp, a frame in space showing a live webcam feed
    class WebcamApp : public RiftApp { protected: gl::Texture2dPtr texture; gl::GeometryPtr videoGeometry; WebcamHandler captureHandler; CaptureData captureData; public: virtual ~WebcamApp() { captureHandler.stopCapture(); } void initGl() { RiftApp::initGl(); texture = GlUtils::initTexture(); #A float aspectRatio = captureHandler.startCapture(); #B videoGeometry = GlUtils::getQuadGeometry(aspectRatio); #C } virtual void update() { if (captureHandler.getResult(captureData)) { #D texture->bind(); #E glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, #E captureData.cols, captureData.rows, #E 0, GL_BGR, GL_UNSIGNED_BYTE, #E captureData.image.data); #E texture->unbind(); #E } } virtual void renderScene() { glClear(GL_DEPTH_BUFFER_BIT); GlUtils::renderSkybox(Resource::IMAGES_SKY_CITY_XNEG_PNG); gl::MatrixStack & mv = gl::Stacks::modelview(); mv.with_push([&]{ mv.identity(); mv.translate(glm::vec3(0, 0, -2)); texture->bind(); #F GlUtils::renderGeometry(videoGeometry); #F texture->unbind(); #F }); } }; RUN_OVR_APP(WebcamApp); #A Reserve an OpenGL texture. This will be the GPU buffer that stores the webcam images. #B startCapture() returns the aspect ratio of the webcam’s resolution. #C Build a quad with the set aspect ratio. #D If there’s a new frame available, then… #E Bind the texture buffer and update it with glTexImage2D. glTexImage2D accepts BGR data and can convert it to RGBA. #F In our render loop, bind the current texture to render a frame in space, positioned three meters ahead of the viewer.