Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. VRDisplay

VRDisplay

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see thecompatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

TheVRDisplay interface of theWebVR API represents any VR device supported by this API. It includes generic information such as device IDs and descriptions, as well as methods for starting to present a VR scene, retrieving eye parameters and display capabilities, and other important functionality.

Note:This interface was part of the oldWebVR API. It has been superseded by theWebXR Device API.

An array of all connected VR Devices can be returned by invoking theNavigator.getVRDisplays() method.

Instance properties

VRDisplay.capabilitiesRead onlyDeprecatedNon-standard

Returns aVRDisplayCapabilities object that indicates the various capabilities of theVRDisplay.

VRDisplay.depthFarDeprecatedNon-standard

Gets and sets the z-depth defining the far plane of theeye view frustum, i.e., the furthest viewable boundary of the scene.

VRDisplay.depthNearDeprecatedNon-standard

Gets and sets the z-depth defining the near plane of theeye view frustum, i.e., the nearest viewable boundary of the scene.

VRDisplay.displayIdRead onlyDeprecatedNon-standard

Returns an identifier for this particular VRDisplay, which is also used as an association point in theGamepad API (seeGamepad.displayId).

VRDisplay.displayNameRead onlyDeprecatedNon-standard

Returns a human-readable name to identify theVRDisplay.

VRDisplay.isConnectedRead onlyDeprecatedNon-standard

Returns a boolean value indicating whether theVRDisplay is connected to the computer.

VRDisplay.isPresentingRead onlyDeprecatedNon-standard

Returns a boolean value indicating whether theVRDisplay is currently having content presented through it.

VRDisplay.stageParametersRead onlyDeprecatedNon-standard

Returns aVRStageParameters object containing room-scale parameters, if theVRDisplay is capable of supporting room-scale experiences.

Instance methods

VRDisplay.getEyeParameters()DeprecatedNon-standard

Returns theVREyeParameters object containing the eye parameters for the specified eye.

VRDisplay.getFrameData()DeprecatedNon-standard

Accepts aVRFrameData object and populates it with the information required to render the current frame.

VRDisplay.getImmediatePose()DeprecatedNon-standard

Returns aVRPose object defining the current pose of theVRDisplay, with no prediction applied. This is no longer needed, and has been removed from the spec.

VRDisplay.getLayers()DeprecatedNon-standard

Returns the layers currently being presented by theVRDisplay.

VRDisplay.getPose()DeprecatedNon-standard

Returns aVRPose object defining the future predicted pose of theVRDisplay as it will be when the current frame is actually presented.This method is deprecated — instead, you should useVRDisplay.getFrameData(), which also provides aVRPose object.

VRDisplay.resetPose()DeprecatedNon-standard

Resets the pose for thisVRDisplay, treating its currentVRPose.position andVRPose.orientation as the "origin/zero" values.

VRDisplay.cancelAnimationFrame()DeprecatedNon-standard

A special implementation ofWindow.cancelAnimationFrame that allows callbacks registered withVRDisplay.requestAnimationFrame() to be unregistered.

VRDisplay.requestAnimationFrame()DeprecatedNon-standard

A special implementation ofWindow.requestAnimationFrame containing a callback function that will be called every time a new frame of theVRDisplay presentation is rendered.

VRDisplay.requestPresent()DeprecatedNon-standard

Starts theVRDisplay presenting a scene.

VRDisplay.exitPresent()DeprecatedNon-standard

Stops theVRDisplay presenting a scene.

VRDisplay.submitFrame()DeprecatedNon-standard

Captures the current state of theVRLayerInit currently being presented and displays it on theVRDisplay.

Examples

js
if (navigator.getVRDisplays) {  console.log("WebVR 1.1 supported");  // Then get the displays attached to the computer  navigator.getVRDisplays().then((displays) => {    // If a display is available, use it to present the scene    if (displays.length > 0) {      vrDisplay = displays[0];      // Now we have our VRDisplay object and can do what we want with it    }  });}

Note:You can see this complete code atraw-webgl-example.

Specifications

This interface was part of the oldWebVR API that has been superseded by theWebXR Device API. It is no longer on track to becoming a standard.

Until all browsers have implemented the newWebXR APIs, it is recommended to rely on frameworks, likeA-Frame,Babylon.js, orThree.js, or apolyfill, to develop WebXR applications that will work across all browsers. ReadMeta's Porting from WebVR to WebXR guide for more information.

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp