/// <summary> /// This API allows an application to trigger creation of a stereo desktop, /// in case the creation was stopped on application launch. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> public static void TriggerActivation(StereoHandle handle) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_Trigger_Activation>()( handle ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
/// <summary> /// This API decreases convergence for the given device interface (just like the Ctrl+F5 hot-key). /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> public static void DecreaseConvergence(StereoHandle handle) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_DecreaseConvergence>()( handle ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
/// <summary> /// This API increases separation for the given device interface (just like the Ctrl+F4 hot-key). /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> public static void IncreaseSeparation(StereoHandle handle) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_IncreaseSeparation>()( handle ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
/// <summary> /// This API captures the current stereo image in PNG stereo format. /// Only the last capture call per flip will be effective. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> public static void CapturePngImage(StereoHandle handle) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_CapturePngImage>()( handle ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
/// <summary> /// This API sets separation to given percentage. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <param name="separationPercentage">New value for separation percentage.</param> public static void SetSeparation(StereoHandle handle, float separationPercentage) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_SetSeparation>()( handle, separationPercentage ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
/// <summary> /// This API sets the back buffer to left or right in Direct stereo mode. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <param name="activeEye">Defines active eye in Direct stereo mode</param> public static void SetActiveEye(StereoHandle handle, StereoActiveEye activeEye) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_SetActiveEye>()( handle, activeEye ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
/// <summary> /// This API turns on/off reverse stereo blit. /// After reversed stereo blit control is turned on, blits from the stereo surface will /// produce the right-eye image in the left side of the destination surface and the left-eye /// image in the right side of the destination surface. /// In DirectX 9, the destination surface must be created as the render target, and StretchRect must be used. /// Conditions: /// - DstWidth == 2*SrcWidth /// - DstHeight == SrcHeight /// - Src surface is the stereo surface. /// - SrcRect must be {0,0,SrcWidth,SrcHeight} /// - DstRect must be {0,0,DstWidth,DstHeight} /// In DirectX 10, ResourceCopyRegion must be used. /// Conditions: /// - DstWidth == 2*SrcWidth /// - DstHeight == SrcHeight /// - dstX == 0, /// - dstY == 0, /// - dstZ == 0, /// - SrcBox: left=top=front==0; right==SrcWidth; bottom==SrcHeight; back==1; /// </summary> /// <param name="handle">Stereo handle corresponding to the device interface.</param> /// <param name="turnOn">A boolean value to enable or disable blit control</param> public static void ReverseStereoBlitControl(StereoHandle handle, bool turnOn) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_ReverseStereoBlitControl>()( handle, (byte)(turnOn ? 1 : 0) ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
/// <summary> /// This API allows an application to enable stereo viewing, without the need of a GUID/Key pair /// This API cannot be used to enable stereo viewing on 3DTV. /// HOW TO USE: Call this function immediately after device creation, then follow with a reset. \n /// Very generically: /// Create Device->Create Stereo Handle->InitActivation->Reset Device /// </summary> /// <param name="handle">Stereo handle corresponding to the device interface.</param> /// <param name="activationFlag">Flags to enable or disable delayed activation.</param> public static void InitActivation(StereoHandle handle, StereoActivationFlag activationFlag) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_InitActivation>()( handle, activationFlag ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
/// <summary> /// This API checks if the last draw call was stereoized. It is a very expensive to call and should be used for /// debugging purpose *only*. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <returns>true if the last draw was a stereo draw; otherwise false</returns> public static bool WasLastDrawStereoizedDebug(StereoHandle handle) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_Debug_WasLastDrawStereoized>()( handle, out var supported ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(supported > 0); } // ReSharper disable CommentTypo
/// <summary> /// This API sets the current frustum adjust mode value. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <param name="frustumAdjustMode">New value for frustum adjust mode.</param> public static void SetFrustumAdjustMode( StereoHandle handle, StereoFrustumAdjustMode frustumAdjustMode) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_SetFrustumAdjustMode>()( handle, frustumAdjustMode ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
/// <summary> /// This API checks if stereo is activated for the given device interface. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <returns>Address where result of the inquiry will be placed.</returns> public static bool IsStereoActivated(StereoHandle handle) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_IsActivated>()( handle, out var isStereoActive ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(isStereoActive > 0); }
/// <summary> /// This API gets the current frustum adjust mode value. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <returns>Current frustum value</returns> public static StereoFrustumAdjustMode GetFrustumAdjustMode(StereoHandle handle) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_GetFrustumAdjustMode>()( handle, out var frustumAdjustMode ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(frustumAdjustMode); }
/// <summary> /// This API returns eye separation as a ratio of [between eye distance]/[physical screen width]. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <returns>Eye separation</returns> public static float GetEyeSeparation(StereoHandle handle) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_GetEyeSeparation>()( handle, out var eyeSeparation ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(eyeSeparation); }
/// <summary> /// This API gets the current convergence value. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <returns>Current convergence value</returns> public static float GetConvergence(StereoHandle handle) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_GetConvergence>()( handle, out var convergence ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(convergence); }
/// <summary> /// This API sets surface creation mode for this device interface. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <param name="surfaceCreateMode">New surface creation mode for this device interface.</param> public static void SetSurfaceCreationMode( StereoHandle handle, StereoSurfaceCreateMode surfaceCreateMode) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_SetSurfaceCreationMode>()( handle, surfaceCreateMode ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
} // ReSharper disable CommentTypo /// <summary> /// This API is a Setup notification message that the stereo driver uses to notify the application /// when the user changes the stereo driver state. /// When the user changes the stereo state (Activated or Deactivated, separation or conversion) /// the stereo driver posts a defined message with the following parameters: /// lParam is the current conversion. (Actual conversion is *(float*)&lParam ) /// wParam == MAKEWPARAM(l, h) where /// - l == 0 if stereo is deactivated /// - l == 1 if stereo is deactivated /// - h is the current separation. (Actual separation is float(h*100.f/0xFFFF) /// Call this API with NULL hWnd to prohibit notification. /// </summary> /// <param name="handle">Stereo handle corresponding to the device interface.</param> /// <param name="windowsHandle"> /// Window handle that will be notified when the user changes the stereo driver state. Actual /// handle must be cast to an <see cref="ulong" />. /// </param> /// <param name="messageId">MessageID of the message that will be posted to window</param> public static void SetNotificationMessage( StereoHandle handle, ulong windowsHandle, ulong messageId) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_Stereo_SetNotificationMessage>()( handle, windowsHandle, messageId ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } }
// ReSharper disable once CommentTypo /// <summary> /// This API allows the user to create a mono or a stereo swap chain. /// NOTE: NvAPI_D3D1x_CreateSwapChain is a wrapper of the method IDXGIFactory::CreateSwapChain which /// additionally notifies the D3D driver of the mode in which the swap chain is to be /// created. /// </summary> /// <param name="handle"> /// Stereo handle that corresponds to the device interface. The device that will write 2D images to /// the swap chain. /// </param> /// <param name="dxgiSwapChainDescription"> /// A pointer to the swap-chain description (DXGI_SWAP_CHAIN_DESC). This parameter /// cannot be NULL. /// </param> /// <param name="swapChainMode">The stereo mode fot the swap chain.</param> /// <returns>A pointer to the swap chain created.</returns> public static IntPtr D3D1XCreateSwapChain( StereoHandle handle, IntPtr dxgiSwapChainDescription, StereoSwapChainMode swapChainMode) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_D3D1x_CreateSwapChain>()( handle, dxgiSwapChainDescription, out var dxgiSwapChain, swapChainMode ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(dxgiSwapChain); }
/// <summary> /// This API allows the user to create a mono or a stereo swap chain. /// NOTE: NvAPI_D3D9_CreateSwapChain is a wrapper of the method IDirect3DDevice9::CreateAdditionalSwapChain which /// additionally notifies the D3D driver if the swap chain creation mode must be stereo or mono. /// </summary> /// <param name="handle">Stereo handle that corresponds to the device interface.</param> /// <param name="d3dPresentParameters">A pointer to the swap-chain description (DXGI). This parameter cannot be NULL.</param> /// <param name="swapChainMode">The stereo mode for the swap chain.</param> /// <returns>A pointer to the swap chain created.</returns> public static IntPtr D3D9CreateSwapChain( StereoHandle handle, // ReSharper disable once InconsistentNaming IntPtr d3dPresentParameters, StereoSwapChainMode swapChainMode) { var status = DelegateFactory.GetDelegate <Delegates.Stereo.NvAPI_D3D9_CreateSwapChain>()( handle, d3dPresentParameters, out var direct3DSwapChain9, swapChainMode ); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(direct3DSwapChain9); }
/// <summary> /// Create a new instance of <see cref="StereoDeviceSession" /> directly from a <see cref="StereoHandle" /> /// </summary> /// <param name="handle">The <see cref="StereoHandle" /> to represent.</param> public StereoDeviceSession(StereoHandle handle) { Handle = handle; }