--- title: VREyeParameters slug: Web/API/VREyeParameters tags: - API - Experimental - Landing - Reference - VR - Virtual Reality - WebVR translation_of: Web/API/VREyeParameters ---
WebVR API의 VREyeParameters 인터페이스는 시야 정보 필드를 포함하여 특정한 눈에 대한 장면을 정확하게 렌더링 하는 데 필요한 모든 정보를 나타냅니다.
{{domxref("VRDisplay.getEyeParameters()")}} 방법을 통해 액세스 할 수 있습니다.
The values in this interface should not be used to compute view or projection matrices. In order to ensure the widest possible hardware compatibility use the matrices provided by {{domxref("VRFrameData")}}.
navigator.getVRDisplays().then(function(displays) {
// If a display is available, use it to present the scene
vrDisplay = displays[0];
console.log('Display found');
// Starting the presentation when the button is clicked:
// It can only be called in response to a user gesture
btn.addEventListener('click', function() {
vrDisplay.requestPresent([{ source: canvas }]).then(function() {
console.log('Presenting to WebVR display');
// Set the canvas size to the size of the vrDisplay viewport
var leftEye = vrDisplay.getEyeParameters('left');
var rightEye = vrDisplay.getEyeParameters('right');
canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;
canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);
drawVRScene();
});
});
});
| 명세 | 상태 | 설명 |
|---|---|---|
| {{SpecName('WebVR 1.1', '#vreyeparameters', 'VREyeParameters')}} | {{Spec2('WebVR 1.1')}} | 최초 정의 |
{{Compat("api.VREyeParameters")}}