Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. static void gfx_ctx_clearfb(void){
  2. eglMakeCurrent( NULL, g_dpy_surf, g_dpy_surf, g_dpy_ctx);
  3.  
  4. char *pixels;
  5. char *mapped_mem;
  6. struct fb_fix_screeninfo finfo;
  7. int mapped_memlen;
  8. int mapped_offset;
  9.  
  10. ioctl(fb, FBIOGET_FSCREENINFO, &finfo);
  11.  
  12. mapped_offset = (((long)finfo.smem_start) -
  13. (((long)finfo.smem_start)&~(getpagesize()-1)));
  14. mapped_memlen = finfo.smem_len+mapped_offset;
  15.  
  16. mapped_mem = mmap(NULL, mapped_memlen,
  17. PROT_READ|PROT_WRITE, MAP_SHARED, fb, 0);
  18. pixels = mapped_mem+mapped_offset;
  19.  
  20. char *rowp = (char *)pixels;
  21.  
  22. //TODO: fix to actual bytes per pixel (assumes 4Bpp = 32bpp)
  23. memset(pixels,0,native_window.height * native_window.width * 4);
  24.  
  25. close (fb);
  26. //glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  27. //eglSwapBuffers(g_egl_dpy, g_egl_surf);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement