From c70dace6942feda07d797feb845782d136097f5c Mon Sep 17 00:00:00 2001 From: Jon Smirl Date: Thu, 19 May 2005 15:03:31 +0000 Subject: Fix EGL fbdev palette problem. demo3 can save ppm of screen --- progs/egl/demo3.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) (limited to 'progs/egl') diff --git a/progs/egl/demo3.c b/progs/egl/demo3.c index 399e3aad9e..f6e3bc56e4 100644 --- a/progs/egl/demo3.c +++ b/progs/egl/demo3.c @@ -500,6 +500,58 @@ static void Draw(EGLDisplay dpy, EGLSurface surf) } } +static void +write_ppm(const char *filename, const GLubyte *buffer, int width, int height) +{ + const int binary = 0; + FILE *f = fopen( filename, "w" ); + if (f) { + int i, x, y; + const GLubyte *ptr = buffer; + if (binary) { + fprintf(f,"P6\n"); + fprintf(f,"# ppm-file created by osdemo.c\n"); + fprintf(f,"%i %i\n", width,height); + fprintf(f,"255\n"); + fclose(f); + f = fopen( filename, "ab" ); /* reopen in binary append mode */ + for (y=height-1; y>=0; y--) { + for (x=0; x=0; y--) { + for (x=0; xpFB, 1024, 768); + eglDestroySurface(d, screen_surf); eglDestroyContext(d, ctx); eglTerminate(d); -- cgit v1.2.3