Graphics Reference
In-Depth Information
Example 3-4
Creating an EGL Window Surface (continued)
case EGL_BAD_NATIVE_WINDOW:
// Verify that provided EGLNativeWindow is valid
break;
case EGL_BAD_ALLOC:
// Not enough resources available; handle and recover
break;
}
}
This creates a place for us to draw into, but we still have two more steps
that must be completed before we can successfully use OpenGL ES 3.0
with our window. Windows, however, are not the only rendering surfaces
that you might find useful. We introduce another type of rendering
surface next before completing our discussion.
Creating an Off-Screen Rendering Area:
EGL Pbuffers
In addition to being able to render into an on-screen window using
OpenGL ES 3.0, you can render into nonvisible off-screen surfaces called
pbuffers (short for pixel buffer ) . Pbuffers can take full advantage of any
hardware acceleration available to OpenGL ES 3.0, just as a window does.
Pbuffers are most often used for generating texture maps. If all you want
to do is render to a texture, we recommend using framebuffer objects
(covered in Chapter 12, “Framebuffer Objects”) instead of pbuffers because
they are more efficient. However, pbuffers can still be useful in some cases
where framebuffer objects cannot be used, such as when rendering an off-
screen surface with OpenGL ES and then using it as a texture in another
API such as OpenVG.
Creating a pbuffer is very similar to creating an EGL window, with a few
minor differences. To create a pbuffer, we need to find an EGLConfig
just as we did for a window, with one modification: We need to
augment the value of EGL_SURFACE_TYPE to include EGL_PBUFFER_BIT .
Once we have a suitable EGLConfig , we can create a pbuffer using the
function
 
 
 
Search WWH ::




Custom Search