Wednesday, May 25, 2011

eglCreatePbufferSurface example c c++ objc java

Name

eglCreatePbufferSurface - create a new EGL pixel buffer surface

C Specification

EGLSurface eglCreatePbufferSurface(EGLDisplay display,
    EGLConfig config,
    EGLint const * attrib_list)

Parameters

display
Specifies the EGL display connection.
config
Specifies the EGL frame buffer configuration that defines the frame buffer resource available to the surface.
attrib_list
Specifies the pixel buffer surface attributes. May be NULL or empty (first attribute is EGL_NONE). Accepted attributes are EGL_WIDTH, EGL_HEIGHT, and EGL_LARGEST_PBUFFER.

Description

eglCreatePbufferSurface creates an off-screen pixel buffer surface and returns its handle. If eglCreatePbufferSurface fails to create a pixel buffer surface, EGL_NO_SURFACE is returned.
Any EGL rendering context that was created with respect to config can be used to render into the surface. Use eglMakeCurrent to attach an EGL rendering context to the surface.
Use eglQuerySurface to retrieve the dimensions of the allocated pixel buffer surface or the ID of config.
Use eglDestroySurface to destroy the surface.
The pixel buffer surface attributes are specified as a list of attribute value pairs, terminated with EGL_NONE. The accepted attributes for an EGL pixel buffer surface are:
EGL_WIDTH
Requests a pixel buffer surface with the specified width. The default value is 0.
EGL_HEIGHT
Requests a pixel buffer surface with the specified height. The default value is 0.
EGL_LARGEST_PBUFFER
Requests a pixel buffer surface with the largest width and height. Use eglQuerySurface to retrieve the dimensions of the allocated pixel buffer. Default value is EGL_FALSE.

Errors of eglCreatePbufferSurface

EGL_NO_SURFACE is returned if creation of the context fails.
EGL_BAD_DISPLAY is generated if display is not an EGL display connection.
EGL_NOT_INITIALIZED is generated if display has not been initialized.
EGL_BAD_CONFIG is generated if config is not an EGL frame buffer configuration.
EGL_BAD_ATTRIBUTE is generated if attrib_list contains an invalid pixel buffer attribute or if an attribute value is not recognized or out of range.
EGL_BAD_ALLOC is generated if there are not enough resources to allocate the new surface.
EGL_BAD_MATCH is generated if config does not support rendering to pixel buffers (the EGL_SURFACE_TYPE attribute does not contain EGL_PBUFFER_BIT).

Copyright

Copyright © 2003 Silicon Graphics, Inc.
This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.

See Also

eglDestroySurface, eglChooseConfig, eglGetConfigs, eglMakeCurrent, eglQuerySurface

Example

iPBuffer = eglCreatePbufferSurface( iDisplay, iPConfig, attrib_list2 );
glGenTextures(1, &pbufferTex);
glBindTexture(GL_TEXTURE_2D, pbufferTex);
eglBindTexImage(iDisplay, iPBuffer, EGL_BACK_BUFFER);
glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);