Commit 0942ed45 authored by Chia-I Wu's avatar Chia-I Wu
Browse files

progs/egl: Fix the blank window in pbuffer demo.

EGL requires eglSwapBuffers to be called on the current surface.
parent f51f62e8
...@@ -168,6 +168,8 @@ draw_both(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf, ...@@ -168,6 +168,8 @@ draw_both(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, wbuf); glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, wbuf);
printf("Window[%d,%d] = 0x%08x\n", x, y, wbuf[y*WinWidth+x]); printf("Window[%d,%d] = 0x%08x\n", x, y, wbuf[y*WinWidth+x]);
eglSwapBuffers(egl_dpy, egl_surf);
/* then draw to pbuffer */ /* then draw to pbuffer */
if (!eglMakeCurrent(egl_dpy, egl_pbuf, egl_pbuf, egl_ctx)) { if (!eglMakeCurrent(egl_dpy, egl_pbuf, egl_pbuf, egl_ctx)) {
printf("Error: eglMakeCurrent(pbuffer) failed\n"); printf("Error: eglMakeCurrent(pbuffer) failed\n");
...@@ -177,7 +179,6 @@ draw_both(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf, ...@@ -177,7 +179,6 @@ draw_both(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, pbuf); glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, pbuf);
printf("Pbuffer[%d,%d] = 0x%08x\n", x, y, pbuf[y*WinWidth+x]); printf("Pbuffer[%d,%d] = 0x%08x\n", x, y, pbuf[y*WinWidth+x]);
eglSwapBuffers(egl_dpy, egl_surf);
/* compare renderings */ /* compare renderings */
for (dif = i = 0; i < WinWidth * WinHeight; i++) { for (dif = i = 0; i < WinWidth * WinHeight; i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment