Name
eglCreatePixmapSurface - create a new EGL pixmap surfaceC Specification
EGLSurface eglCreatePixmapSurface(EGLDisplay display,
EGLConfig config,
NativePixmapType native_pixmap,
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.
native_pixmap- Specifies the native pixmap.
attrib_list- Specifies pixmap surface attributes. Must be
NULLor empty (first attribute isEGL_NONE).
Description
eglCreatePixmapSurface creates an off-screen EGL pixmap surface and returns its handle. If eglCreatePixmapSurface fails to create a pixmap 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 ID of config.Use
eglDestroySurface to destroy the surface.Errors
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 config.EGL_BAD_NATIVE_PIXMAP may be generated if native_pixmap is not a valid native pixmap.EGL_BAD_ATTRIBUTE is generated if attrib_list contains an invalid pixmap 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 the attributes of native_pixmap do not correspond to config or if config does not support rendering to pixmaps (the EGL_SURFACE_TYPE attribute does not contain EGL_PIXMAP_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, eglQuerySurfaceExample
boolean InitEGL(MyTest *pMe){
EGLConfig myConfig;
EGLint ncfg = 1;
EGLint params[5] = {EGL_NONE,EGL_NONE,EGL_NONE,EGL_NONE,EGL_NONE};
// Init State Data
pMe->egl_display_p = EGL_NO_DISPLAY;
pMe->egl_surface_p = EGL_NO_SURFACE;
pMe->egl_context_p = EGL_NO_CONTEXT;
// Main Display
pMe->egl_display_p = eglGetDisplay( pMe->a.m_pIDisplay );
if( pMe->egl_display_p == EGL_NO_DISPLAY || eglGetError() != EGL_SUCCESS )
return FALSE;
if( eglInitialize( pMe->egl_display_p, NULL, NULL ) == EGL_FALSE || eglGetError() != EGL_SUCCESS )
return FALSE;
// Get Configuration
eglGetConfigs( pMe->egl_display_p, &myConfig, 1, &ncfg );
//***pixmap surface***
{
NativePixmapType pixmap = NULL;
if(IBITMAP_QueryInterface(pMe->m_pDDBitmap, AEECLSID_DIB, (void**)&pixmap) != SUCCESS)
return EFAILED;
pMe->egl_surface_p = eglCreatePixmapSurface(pMe->egl_display_p, myConfig, pixmap, NULL);
IDIB_Release(pixmap);
if( pMe->egl_surface_p == EGL_NO_SURFACE || eglGetError() != EGL_SUCCESS )
return FALSE;
}
//***pixmap surface***
// Window Surface
// if comment out ***pixmap surface*** use eglCreateWindowSurface() as below, it works
/*{
IDIB *pDIB;
if( IBITMAP_QueryInterface(pMe->m_pDDBitmap, AEECLSID_DIB, (void**)&pDIB) != SUCCESS )
return EFAILED;
pMe->egl_surface_p = eglCreateWindowSurface( pMe->egl_display_p, myConfig, pDIB, params );
IDIB_Release( pDIB );
if( pMe->egl_surface_p == EGL_NO_SURFACE || eglGetError() != EGL_SUCCESS )
return FALSE;
}*/
// Context
pMe->egl_context_p = eglCreateContext( pMe->egl_display_p, myConfig, 0, 0 );
if( pMe->egl_context_p == EGL_NO_CONTEXT || eglGetError() != EGL_SUCCESS )
return FALSE;
if( eglMakeCurrent( pMe->egl_display_p, pMe->egl_surface_p, pMe->egl_surface_p, pMe->egl_context_p ) == EGL_FALSE || eglGetError() != EGL_SUCCESS )
return FALSE;
return TRUE;
}