
Data Transfer
Quadro SDI Output PG-03776-001_v06 | 18
Code Listing 14: Get Video Devices Available on the System
HPVIDEODEV hpDevList;
if ((wglGetVideoDeviceNV(hDC, 1, &hpDevList) != GL_NOERROR) {
// Handle error.
}
Once a video device has been identified, bind the application pbuffers using the
wglBindVideoImageNV() command. The final argument to this function must be one of
WGL_VIDEO_OUT_COLOR_NV, WGL_VIDEO_OUT_ALPHA_NV,
WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV
or WGL_VIDEO_OUT_COLOR_AND_DEPTH._NV.
This argument specifies the data within the pbuffer that will ultimately get transferred
to the video out device. In Code Listing 15, the color and alpha portions of the pbuffer
specified by hPbuf are bound to the video device.
Code Listing 15: Binding a Pbuffer to a Video Device
if ((wglBindVideoImageNV(hpDevList, hPbuf,
WGL_VIDEO_OUT_COLOR_AND_ALPHA) != GL_NOERROR) {
// Handle error.
}
On Linux, a pbuffer is created using a combination of glxChooseFBConfig() to choose
compatible frame buffer configurations and
glXCreatePbuffer() to create a pbuffer of
the width and height required. This process for both an 8-bit integer and a 16-bit floating
point pbuffer is outlined in Code Listing 16 and Code Listing 17.
Note: Once glXChooseFBConfig returns the list of compatible frame buffer
configurations, an application must traverse the list to find a configuration of the
desired color depth.
Code Listing 16: Creating an 8-bit Pbuffer on Linux
GLXFBConfig *configs, config;
int nelements;
int config_list[] = { GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
GLX_ALPHA_SIZE, 8,
GLX_DOUBLE_BUFFER, GL_TRUE,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
None };
int pbuffer_list[8];
configs = glXChooseFBConfig(dpy, 0, config_list, &nelements);
// Find a config with the right number of color bits.
for (i = 0; i < nelements; i++) {
Kommentare zu diesen Handbüchern