Stereo with /without NVAPI


I’m currently trying to get my application working in stereo via nvidia quadro quadbuffer.

I want to specify myself the projection matrices for each eye, etc… so I don’t use NVIDIA automatic stereo mode.

The application is written in directx 11 via SLIMDX. I enabled stereo in nvidia control panel.

Here’s some problems that I encountered, hope somebody can help me:

With NVApi, I used the API as explained in this document: and by looking into nvapi.h,

I did it like this:

  • Initialization :

            status = NvAPI_Initialize();
            status = NvAPI_Stereo_Enable();
            status = NvAPI_Stereo_IsEnabled(ref IsStereoEnabled);
            // Stereo status report an error
            if (status != _NvAPI_Status.NVAPI_OK)
                // 3D Vision driver is not installed on the system
                MessageBox.Show("NVApi initialization failed: " + status, "VU Error");
            // Stereo is available but not enabled, let's enable it
            else if (_NvAPI_Status.NVAPI_OK == status && !IsStereoEnabled)
                status = NvAPI_Stereo_Enable();
                status = NvAPI_Stereo_IsEnabled(ref IsStereoEnabled);
            // enable direct mode after creating device
            status = NvAPI_Stereo_SetDriverMode(NVAPI_STEREO_DRIVER_MODE_DIRECT);
  • handle creation from device : NvAPI_Stereo_CreateHandleFromIUnknown

  • Left and right eye rendering:
    NvAPI_Stereo_SetActiveEye(right), then render scene
    NvAPI_Stereo_SetActiveEye(left), then render scene

First I could not have this code working, the return code of NvAPI_Stereo_Enable and NvAPI_Stereo_IsEnabled is NVAPI_STEREO_NOT_INITIALIZED.

After a lot of search, I finally had this code working by setting then unsetting 'Enable stereoscopic 3D" in NVIDIA control panel.

It’s like something was triggered when setting/unsetting this checkbox…

So by doing this “hack”, I can have stereo working in my application.

But, I’d like to know what this checkbox does and why I have to set/unset it to have my code work.

Is there a workaround for this, as I’m not sure I will be allowed to do this hack…

My second question is about the fact that I found on internet (

another way to do stereo with quadbuffer, by doing this:

  • Render left eye image
  • Render right eye image
  • Create a texture able to contain them both PLUS an extra row (so the texture size would be 2 * width, height + 1)
  • Write this NV_STEREO_IMAGE_SIGNATURE value
  • Render this texture on the screen

I tried to do it but for now I can’t make it work.

My question is, is it possible to have stereo this way? Is it better to do it this way or to use NvAPI_Stereo_SetActiveEye ?

Is the result the same?

I also found these to sentences in the doc ( which I don’t understand:

“The application then needs to set up the viewport with half the width for the
right eye and the other half for the left eye”


“The viewport is split between the right and left eye:
g_LeftSideViewport.Width = g_DXGISwapChainDesc.BufferDesc.Width/2;
g_LeftSideViewport.Height = g_DXGISwapChainDesc.BufferDesc.Height/2;
g_LeftSideViewport.MinDepth = 0.0f;
g_LeftSideViewport.MaxDepth = 1.0f;
g_LeftSideViewport.TopLeftX = 0;
g_LeftSideViewport.TopLeftY = g_LeftSideViewport.Height/2;
g_RightSideViewport.Width = g_DXGISwapChainDesc.BufferDesc.Width/2;
g_RightSideViewport.Height = g_DXGISwapChainDesc.BufferDesc.Height/2;
g_RightSideViewport.MinDepth = 0.0f;
g_RightSideViewport.MaxDepth = 1.0f;
g_RightSideViewport.TopLeftX = g_RightSideViewport.Width;
g_RightSideViewport.TopLeftY = g_RightSideViewport.Height/2;”

Could someone explain this to me? why am I able to have stereo without doing it (by using NvAPI_Stereo_SetActiveEye) ?

To conclude, I’m very confused because it looks like to me that there are two ways of doing quadbuffer stereo with nvidia cards/driver and I don’t understand what is the good way to do it.

Is it possible to have a working code sample which can be used as an example of making a stereo app in directx?

Thank you!


I also has this problem.

Wow! What a thread!