Skip to content

Commit 91bf00d

Browse files
committed
Enable 90Hz mode for Oculus
1 parent 8bf5d79 commit 91bf00d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Assets/Scripts/VrSdk.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,17 @@ void Awake()
192192
manager.useRecommendedMSAALevel = false;
193193

194194
SetControllerStyle(TiltBrush.ControllerStyle.OculusTouch);
195+
196+
// Set 90Hz if possible. To see the current framerate, look in the logs for prints like this one. The first number is the frame rate, the second is the display refresh rate
197+
// VrApi : FPS=90/90,Prd=33ms,Tear=0,Early=0...
198+
float[] freqs = OVRManager.display.displayFrequenciesAvailable;
199+
Debug.Log($"Supported frequencies are: {freqs}");
200+
if (Array.Exists(freqs, element => element == 90.0f))
201+
{
202+
OVRPlugin.systemDisplayFrequency = 90.0f;
203+
}
204+
OVRManager.DisplayRefreshRateChanged += DisplayRefreshRateChanged;
205+
195206
// adding components to the VR Camera needed for fading view and getting controller poses.
196207
m_VrCamera.gameObject.AddComponent<OculusCameraFade>();
197208
m_VrCamera.gameObject.AddComponent<OculusPreCullHook>();
@@ -339,6 +350,13 @@ private void OnInputFocus(params object[] args)
339350
m_HasVrFocus = (bool)args[0];
340351
}
341352

353+
#if OCULUS_SUPPORTED
354+
private void DisplayRefreshRateChanged (float fromRefreshRate, float ToRefreshRate)
355+
{
356+
Debug.LogWarning(string.Format("Refresh rate changed from {0} to {1}", fromRefreshRate, ToRefreshRate));
357+
}
358+
#endif
359+
342360
private void OnNewPoses()
343361
{
344362
if (NewControllerPosesApplied != null)

0 commit comments

Comments
 (0)