damian0815
Posts: 3
Joined: Fri Nov 16, 2012 6:42 pm

single buffered eglSurface

Mon Nov 26, 2012 8:47 pm

I have an OpenGL ES 2 app that's working fine with the default window surface:

Code: Select all

eglSurface = eglCreateWindowSurface( eglDisplay, config, nativeWindow, NULL );
When I try and make it single buffered, like this:

Code: Select all

    static const EGLint surf_attribute_list[] = {
    EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER,
    EGL_NONE // attribute list is termintated with EGL_NONE
};
eglSurface = eglCreateWindowSurface( eglDisplay, config, nativeWindow, surf_attribute_list );
the returned eglSurface seems to be valid (it doesn't generate an error), but I no longer see anything drawn on the screen.

Is there something else I need to do to switch from double to single buffering?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5708
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: single buffered eglSurface

Tue Nov 27, 2012 2:03 pm

Our 3D guy says:

"eglSwapBuffers() doesn't do anything for single-buffered surfaces (from the EGL spec, "If surface is a single-buffered window, pixmap, or pbuffer surface, eglSwapBuffers has no effect.")

If he replaces the eglSwapBuffers() calls with eg glFlush() he should see stuff.

(Or at least that's my best guess without seeing the rest of his code)"

damian0815
Posts: 3
Joined: Fri Nov 16, 2012 6:42 pm

Re: single buffered eglSurface

Mon Dec 03, 2012 8:18 am

hey Dom,

thanks for the advice, but unfortunately that wasn't enough.

I remember reading somewhere that EGL + GLES just doesn't allow single buffered surfaces when using eglCreateWindowSurface (ie, i suppose, due to the hardware design the backbuffer is always cleared every blit). I guess I can use eglCreatePixmapSurface or eglCreatePbufferSurface then treat the returned surfaces as a texture and draw them to a surface made with eglCreateWindowSurface.

The only reason all this is necessary is so that I can get a single-buffered MSAA window.

Return to “Graphics programming”