eglSwapBuffers - back buffer gets reset/turned black?

I’m developing an OpenVG app for a Windows CE 6.0 platform. My config is:

Chosen Config (0x00000007):
EGL_ALPHA_MASK_SIZE = 0x00000008
EGL_ALPHA_SIZE = 0x00000000
EGL_BIND_TO_TEXTURE_RGB = 0x00000000
EGL_BIND_TO_TEXTURE_RGBA = 0x00000000
EGL_BLUE_SIZE = 0x00000005
EGL_BUFFER_SIZE = 0x00000010
EGL_COLOR_BUFFER_TYPE = 0x0000308E
EGL_CONFIG_CAVEAT = 0x00003038
EGL_CONFIG_ID = 0x00000007
EGL_CONFORMANT = 0x00000007
EGL_DEPTH_SIZE = 0x00000000
EGL_GREEN_SIZE = 0x00000006
EGL_LEVEL = 0x00000000
EGL_LUMINANCE_SIZE = 0x00000000
ERROR 0x3004 calling eglGetConfigAttrib(EGL_MATCH_NATIVE_PIXMAP)
EGL_MAX_PBUFFER_HEIGHT = 0x00000800
EGL_MAX_PBUFFER_PIXELS = 0x00400000
EGL_MAX_PBUFFER_WIDTH = 0x00000800
EGL_MAX_SWAP_INTERVAL = 0x00000001
EGL_MIN_SWAP_INTERVAL = 0x00000001
EGL_NATIVE_RENDERABLE = 0x00000000
EGL_NATIVE_VISUAL_ID = 0x00000000
EGL_NATIVE_VISUAL_TYPE = 0x00000000
ERROR 0x3004 calling eglGetConfigAttrib(EGL_PRESERVED_RESOURCES)
EGL_RED_SIZE = 0x00000005
EGL_RENDERABLE_TYPE = 0x00000007
EGL_SAMPLE_BUFFERS = 0x00000000
EGL_SAMPLES = 0x00000000
EGL_STENCIL_SIZE = 0x00000000
EGL_SURFACE_TYPE = 0x00000027
EGL_TRANSPARENT_BLUE_VALUE = 0xFFFFFFFF
EGL_TRANSPARENT_GREEN_VALUE = 0xFFFFFFFF
EGL_TRANSPARENT_RED_VALUE = 0xFFFFFFFF
EGL_TRANSPARENT_TYPE = 0x00003038
ERROR 0x3004 calling eglSurfaceAttrib(ELG_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED)
EGL_SWAP_BEHAVIOR = 0x3095

I have code that executes two eglSwapBuffers() calls in a row:


if (EGL_FALSE == eglSwapBuffers(eglDisplay, eglSurface)) HandleEglError();
if (EGL_FALSE == eglSwapBuffers(eglDisplay, eglSurface)) HandleEglError();

When the first one executes, the entire window area turns blue (that’s the expected behavior).
When the second one executes, the entire window area turns black (quite unexpected).
At other times through the code, the second one will leave the window blue.

Now, I’m not new to programming but I am quite new to OpenVG/OpenGL, so it’s entirely possible that I’ve got something configured incorrectly.

I’m curious: if I wanted this behavior, what would I do? Basically, I’m trying to figure out what configuration setting/OpenVG/OpenGL call I might have done to cause this.

Is there anything I can do to determine what attributes on the display or surface might be affecting this?

Any ideas? Anyone?

Thanks!
– Steve G.

Since the config does not support the swap behaviour EGL_BUFFER_PRESERVED, it means that the contents of the backbuffer after a call to eglSwapBuffers are undefined. Since you don’t draw anything in between the two eglSwapBuffers calls, the undefined contents become visible. In this particular case it just happens to be black.

It is likely that your target platform uses buffer flipping, which means the previous frontbuffer becomes the backbuffer and vice versa, and black is just the initial buffer state.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.