examples/Qt/ISFEditor/ISFEditor_app/Spout/SpoutGLDXinterop.cpp
//	Link a shared DirectX texture to an OpenGL texture
//	and create a GLDX interop object handle
//
//	IN	pSharedTexture  Pointer to shared the DirectX texture
//	IN	dxShareHandle   Handle of the DirectX texture to be shared
//	IN	glTextureID     ID of the OpenGL texture that is to be linked to the shared DirectX texture
//	Returns             Handle to the GL/DirectX interop object (the shared texture)
//

Link a shared DirectX texture to an OpenGL texture
and create a GLDX interop object handle

IN      pSharedTexture  Pointer to shared the DirectX texture
IN      dxShareHandle   Handle of the DirectX texture to be shared
IN      glTextureID     ID of the OpenGL texture that is to be linked to the shared DirectX texture
Returns             Handle to the GL/DirectX interop object (the shared texture)
Link a shared DirectX texture to an OpenGL texture and create a GLDX interop object handle IN pSharedTexture Pointer to shared the DirectX texture IN dxShareHandle Handle of the DirectX texture to be shared IN glTextureID ID of the OpenGL texture that is to be linked to the shared DirectX texture Returns Handle to the GL / DirectX interop object ( the shared texture )
HANDLE spoutGLDXinterop::LinkGLDXtextures (	void* pDXdevice,
											void* pSharedTexture,
											HANDLE dxShareHandle,
											GLuint glTexture) 
{
	HANDLE hInteropObject;
	if(!m_hInteropDevice) {
		m_hInteropDevice = wglDXOpenDeviceNV(pDXdevice);
	}
	if (m_hInteropDevice == NULL) {
		printf("    LinkGLDXtextures error 1 : could not create interop device from pDXdevice\n");
		return NULL;
	}
	if (!wglDXSetResourceShareHandleNV(pSharedTexture, dxShareHandle)) {
		printf("    LinkGLDXtextures error 2 : wglDXSetResourceShareHandleNV failed\n");
		return NULL;
	}
	hInteropObject = wglDXRegisterObjectNV( m_hInteropDevice,
											pSharedTexture,	
											glTexture,		
											GL_TEXTURE_2D,	
											WGL_ACCESS_READ_WRITE_NV); 
	if(!hInteropObject) {
		printf("    LinkGLDXtextures error 3 : wglDXRegisterObjectNV failed\n");
	}
	return hInteropObject;
}
HANDLE spoutGLDXinterop :: LinkGLDXtextures ( void * pDXdevice , void * pSharedTexture , HANDLE dxShareHandle , GLuint glTexture ) { HANDLE hInteropObject ; if ( ! m_hInteropDevice ) { m_hInteropDevice = wglDXOpenDeviceNV ( pDXdevice ) ; } if ( m_hInteropDevice == NULL ) { printf ( " \n " ) ; return NULL ; } if ( ! wglDXSetResourceShareHandleNV ( pSharedTexture , dxShareHandle ) ) { printf ( " \n " ) ; return NULL ; } hInteropObject = wglDXRegisterObjectNV ( m_hInteropDevice , pSharedTexture , glTexture , GL_TEXTURE_2D , WGL_ACCESS_READ_WRITE_NV ) ; if ( ! hInteropObject ) { printf ( " \n " ) ; } return hInteropObject ; }
Link a shared DirectX texture to an OpenGL texture
and create a GLDX interop object handle
Link a shared DirectX texture to an OpenGL texture and create a GLDX interop object handle
// printf("LinkGLDXtextures (%x, %x, %x, %x)\n", pDXdevice, pSharedTexture, dxShareHandle, glTexture);
 // printf("    m_hInteropDevice = %x\n", m_hInteropDevice);
 // Prepare the DirectX device for interoperability with OpenGL
 // The return value is a handle to a GL/DirectX interop device.
 // printf("    LinkGLDXtextures creating interop device from %x\n", pDXdevice);
 // prepare shared resource
 // wglDXSetResourceShareHandle does not need to be called for DirectX
 // version 10 and 11 resources. Calling this function for DirectX 10
 // and 11 resources is not an error but has no effect.
 // Prepare the DirectX texture for use by OpenGL
 // register for interop and associate the opengl texture with the dx texture
 // DX texture
 // OpenGL texture
 // Must be TEXTURE_2D - multisampling not supported
 // We will write and the receiver will read
 // printf("LinkGLDXtextures (%x, %x, %x, %x)\n", pDXdevice, pSharedTexture, dxShareHandle, glTexture);
 // printf("    m_hInteropDevice = %x\n", m_hInteropDevice);	
