nvapi use of NvAPI_Stereo_SetDriverMode in d3d10

1.5k views Asked by At

I'm currently trying to set nvapi to work in a direct mode with the function NvAPI_Stereo_SetDriverMode.

According to Nvidia nvapi site (in the manual), if you would like to make a direct3d implementation you need to initialize nvpai , then set direct mode , then create the device (d3d10device) , and then create stereo handle ... (continue of the program).

NvAPI_Initialize();
NvAPI_Stereo_SetDriverMode(g_StereoHandle , NVAPI_STEREO_DRIVER_MODE_DIRECT);
D3D10CreateDeviceAndSwapChain(...,pD3D10Device);
NvAPI_Stereo_CreateHandleFromIUnknown(pD3D10Device,&g_StereoHandle );
.....(the rest)

I tried it but then the function NvAPI_Stereo_SetActiveEye (which tells to which eye do I want to render my meshes)says the mode isn't in direct mode.

When I looked at the header file I found out that the mode should be called after you create the handle. But when I did that it returned NVAPI_INVALID_ARGUMENT (and again I can't set the active eye).

NvAPI_Initialize();
D3D10CreateDeviceAndSwapChain(...,pD3D10Device);
NvAPI_Stereo_CreateHandleFromIUnknown(pD3D10Device,&g_StereoHandle );
NvAPI_Stereo_SetDriverMode(g_StereoHandle , NVAPI_STEREO_DRIVER_MODE_DIRECT);
.....(the rest)

Does anyone encountered the same problem?

I've tried to look at examples with nvapi on the web but it seems it's new and the nvidia developer zone is down(due to some technical probs).

2

There are 2 answers

0
killer_mech On

In case anyone comes looking for a working example of

NvAPI_STEREO_DRIVER_MODE_DIRECT

then here is the link to a project I came across on github. Here the example demonstrates the initialization in of stereo before d3d device & shows usage of rendering in each eyes with back buffer. As for the OP the first method should work because DirectMode requires NVAPI & NvAPI_Stereo_SetDriverMode to be initialized first before the device is created. Hope this helps someone :)

0
MaMazav On

That's strange.

  1. The way shown in NVidia site (the first one you presented) works for me.
  2. SetDriverMode does not accept a parameter of stereo handle (in opposite to the code you copied).

maybe someone added an evil '#define' in your code? :)