Cuda Interop Through PhysX

Hi

I’m having an issue getting interop capabilities running. I can successfully run on the GPU without Interop, however as soon as I attempt to activate the Interop the CudaContextManager context becomes invalid.

I am on Visual Studio 2012 using OpenGL as my render system through Ogre 3D rendering engine on x64. I am currently linked to the debug versions of the libraries, though I was on CHECKED originally:

PhysX3CommonDEBUG_x64.lib
PhysX3DEBUG_x64.lib
PhysX3ExtensionsDEBUG.lib
PxTaskDEBUG.lib
PhysXProfileSDKDEBUG.lib
PhysXVisualDebuggerSDKDEBUG.lib

In case I am missing a necessary lib, there’s what I have linked so far.

My current code:

if(initializeCuda)
{
	if(!descriptor.gpuDispatcher)
	{
	
	physx::PxCudaContextManagerDesc cudaContextManagerDesc;
	cudaContextManagerDesc.interopMode = physx::PxCudaInteropMode::OGL_INTEROP;
	
        HGLRC hg = wglGetCurrentContext();
	cudaContextManagerDesc.graphicsDevice = (void*)&hg;///I know I don't need to do it this way, just part of debugging
				
	cudaContextManager = physx::PxCreateCudaContextManager(PxGetFoundation(), cudaContextManagerDesc, PxGetPhysics().getProfileZoneManager());
				   
	std::string result;

	if(cudaContextManager->contextIsValid())
		result = "Context Valid";
	else
	        result = "Not Valid";

        printf(result.c_str());

        if(cudaContextManager)
             descriptor.gpuDispatcher = cudaContextManager->getGpuDispatcher();

I can confirm that I am getting a valid HGLRC, so if anyone has any ideas, I would greatly appreciate the assistance. The part where it fails is at ContextIsValid(). And as I said above, if not using Interop, everything runs smoothly. So it would appear I have a correct setup.

I’m hoping someone can help me with this as I have spent a couple days on this now.

Thank you

Figured it out.

Had to go through NVidia Control Panel->Manage 3D Settings->Set Preferred GPU to my dedicated…apparently it was defaulting to my Integrated.