
Data Transfer
Quadro SDI Output PG-03776-001_v06 | 15
Creation of an FBO is identical on both Windows and Linux, and requires only a current
OpenGL context. In the previous code listing example, when a texture object is specified,
it is attached as
COLOR_ATTACHMENT0, otherwise, a renderbuffer is used. For more
information on FBO creation and usage, refer to the
GL_EXT_framebuffer_object
specification.
In order for an application to render into an FBO render target, the target must first be
bound using the command in Code Listing 9.
Code Listing 9: Configuring a Frame Buffer Object
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);
Either before or after buffer object creation, the SDI video device must be bound in
OpenGL. The procedure for enumerating the available video devices and binding one of
them is outlined in Code Listing 10.
Code Listing 10: Binding a Video Device
// Enumerate the available video devices and
// bind to the first one found
HVIDEOOUTPUTDEVICENV *videoDevices;
// Get list of available video devices.
int numDevices = wglEnumerateVideoDevicesNV(ghWinDC, NULL);
if (numDevices <= 0) {
MessageBox(NULL, "wglEnumerateVideoDevicesNV() did not return
any devices.", "Error", MB_OK);
exit(1);
}
videoDevices = (HVIDEOOUTPUTDEVICENV *)malloc(numDevices *
sizeof(HVIDEOOUTPUTDEVICENV));
if (!videoDevices) {
fprintf(stderr, "malloc failed. OOM?");
exit(1);
}
if (numDevices != wglEnumerateVideoDevicesNV(ghWinDC,
videoDevices)) {
free(videoDevices);
MessageBox(NULL, "Invonsistent results from
wglEnumerateVideoDevicesNV()", "Error", MB_OK);
exit(1);
}
//Bind the first device found.
if (!wglBindVideoDeviceNV(ghWinDC, 1, videoDevices[0], NULL)) {
free(videoDevices);
Kommentare zu diesen Handbüchern