Results 1 to 4 of 4

Thread: Can eglCreateWindowSurface be used for off-screen rendering?

  1. #1

    Can eglCreateWindowSurface be used for off-screen rendering?


    we're are wondering if eglCreateWindowSurface can be used for off-screen rendering and benefit from the eglSwapBuffers function instead of using the time consuming function glReadPixels.
    Or should we only use eglCreatePbufferSurface which we know is made for off-screen rendering?


    Last edited by Wonderketchup; 11-21-2016 at 02:36 AM.

  2. #2
    Junior Member
    Join Date
    Feb 2012
    When you use eglCreateWindowSurface, the buffers are generally ownership of the window system and part of the "window". The only way to get to the pixels is to use glReadPixels or use eglLockSurface and query for the buffer and all the attributes that describe its memory layout. But that is not always supported.

    eglCreatePbufferSurface was intended for use of offscreen rendering - specifically EGL owns the buffer. However, since the addition of GL/GLES Renderbuffers objects these can be more efficient and have all the same features.

    If access to the pixels is paramount, and your driver supports it, creating an EGLImage using eglCreateImage you either provide or have access to a texture, made from the image, or image made from texture, that can be used with a Framebufferobject. Then you can access the pixels of the image - provided you understand the memory layout of the pixels/buffer.

    Hope that covers your use case.

  3. #3
    To create a window surface, you call the eglCreateWindowSurface() function. Before you call this function, you should initialize your EGLDisplay, EGLConfig, and native window ( screen_window_t). You also need to ensure that EGL_SURFACE_TYPE in your EGL configuration is set to EGL_WINDOW_BIT. The last parameter is reserved for surface attributes using attribute-value pairs, but you can set this parameter to NULL. For more information on valid attribute-value pairs, see the eglCreateWindowSurface() API reference.

  4. #4
    Join Date
    Jun 2017
    Thanks StonesThrow & beispiel for detailed and easy to follow instructions. Was also using glReadPixels, but no more of that now.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean