
Data Transfer
Quadro SDI Output PG-03776-001_v06 | 13
Code Listing 7: Selecting the GPU that is connected to the Output
Card on Windows
while(wglEnumGpusNV(GPUindex,&GPUHandle)) // First call this
//function to get a handle to the gpu
{
//get detailed GPU info
while(wglEnumGpuDevicesNV(GPUHandle,DisplayIdx,&gpuDevice))
{
NvAPI_GetAssociatedNvidiaDisplayHandle(gpuDevice.DeviceName,
&hNvDisplay);
NvAPI_GetPhysicalGPUsFromDisplay(hNvDisplay,&hNvPhysicalGPU,
&count);
if(m_hPhysicalGpu == hNvPhysicalGPU)
{
//save the GPU affinity GPU handle to use
// for creating the OpenGL context
m_gpuHandle = GPUHandle;
break;
}
…
}
//Now an OpenGL context can be created
HGPUNV handles[2];
handles[0] = hGpu;
handles[1] = NULL;
// Create Affinity context
hDC = wglCreateAffinityDCNV(handles);
setPixelFormat(hDC);
// Create rendering context from the affinity device context
hRC = wglCreateContext(hDC);
// Make the affinity context current
wglMakeCurrent(hDC, hRC);
On Linux things are much simpler since all the important
NVCtrl X extension calls and
the GLX context creating call are already using an X screen as one of the parameters.
5.2 BUFFER OBJECT INITIALIZATION
Use of the GL_NV_present_video extension to send GPU rendered content to the SDI
device requires the use of one or more buffer objects. These buffer objects can be texture
objects or renderbuffers bound to one or more frame buffer objects (FBOs). Creation of
an FBO with a texture or render buffer attachment is demonstrated in Code Listing 8.
Comentarios a estos manuales