static bool pendingBlit; // for chaining across cameras (since Unity doesn't handle this properly) void OnPreRender() { if (pendingBlit) { Graphics.Blit(SteamVR_Camera.sceneTexture, RenderTexture.active); } if (tracker.wireframe) { GL.wireframe = true; } if (clearFlags == CameraClearFlags.Skybox) { var material = GetSkyboxMaterial(); if (material != null) { SteamVR_Utils.DrawSkybox(material, tracker.offset.rotation, camera.projectionMatrix); } else { GL.Clear(true, true, Color.black); GL.PushMatrix(); GL.PopMatrix(); // Necessary when setting clearFlags to Nothing for some reason. } } else { var clearColor = clearFlags == CameraClearFlags.Color; var clearDepth = clearFlags != CameraClearFlags.Nothing; GL.Clear(clearDepth, clearColor, camera.backgroundColor); GL.PushMatrix(); GL.PopMatrix(); // Necessary when setting clearFlags to Nothing for some reason. } }